bugAVR C Runtime Library - Bugs: bug #36454, string.h: Error for long long in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #36454: string.h: Error for long long in C90

Submitter:  Georg-Johann Lay <gjlayde>
Submitted:  Sat 12 May 2012 08:27:10 AM UTC
   
 
Category:  Header Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  joerg_wunsch
Percent Complete:  0% Open/Closed:  Closed
Release:  1.8.0 Fixed Release:  1.8.1

Mon 14 May 2012 01:41:01 PM UTC, comment #4: 


> Another try:
>
> -extern int ffsll (long long val) __ATTR_CONST;
> +__extension__ extern int ffsll (long long val) __ATTR_CONST;


Yes, looks better. No more complaints.

Thanks.

Georg-Johann Lay <gjlayde>
Sat 12 May 2012 02:12:49 PM UTC, comment #3: 

Another try:

Index: include/string.h
===================================================================
--- include/string.h    (revision 2291)
+++ include/string.h    (working copy)
@@ -110,7 +110,7 @@
 
 extern int ffs (int _val) __ATTR_CONST_;
 extern int ffsl (long _val) __ATTR_CONST_;
-extern int ffsll (long long _val) __ATTR_CONST_;
+__extension__ extern int ffsll (long long _val) __ATTR_CONST_;
 extern void memccpy(void , const void *, int, size_t);
 extern void memchr(const void , int, size_t) _ATTR_PURE_;
 extern int memcmp(const void , const void , size_t) _ATTR_PURE_;

The advantage of using _extension_ over the #ifdef solution
is that it also covers the -std=gnu89 case.

Joerg Wunsch <joerg_wunsch>
Group administrator
Sat 12 May 2012 10:14:19 AM UTC, comment #2: 

Joerg Wunsch schrieb:

> Follow-up Comment #1:
>
> Would this help?
>
> Index: include/string.h
> ===================================================================
> --- include/string.h    (revision 2291)
> +++ include/string.h    (working copy)
> @@ -110,7 +110,7 @@

>  extern int ffs (int _val) __ATTR_CONST_;
>  extern int ffsl (long _val) __ATTR_CONST_;
> -extern int ffsll (long long _val) __ATTR_CONST_;
> +extern int ffsll (_extension_ long long _val) __ATTR_CONST_;
>  extern void memccpy(void , const void *, int, size_t);
>  extern void memchr(const void , int, size_t) _ATTR_PURE_;
>  extern int memcmp(const void , const void , size_t) _ATTR_PURE_;


gcc says:

error: expected declaration specifiers or '...' before '__extension__'

I tried _extension_ already but could not find a working syntax.

Georg-Johann Lay <gjlayde>
Sat 12 May 2012 09:15:47 AM UTC, comment #1: 

Would this help?

Index: include/string.h
===================================================================
--- include/string.h    (revision 2291)
+++ include/string.h    (working copy)
@@ -110,7 +110,7 @@
 
 extern int ffs (int _val) __ATTR_CONST_;
 extern int ffsl (long _val) __ATTR_CONST_;
-extern int ffsll (long long _val) __ATTR_CONST_;
+extern int ffsll (_extension_ long long _val) __ATTR_CONST_;
 extern void memccpy(void , const void *, int, size_t);
 extern void memchr(const void , int, size_t) _ATTR_PURE_;
 extern int memcmp(const void , const void , size_t) _ATTR_PURE_;

Joerg Wunsch <joerg_wunsch>
Group administrator
Sat 12 May 2012 08:27:10 AM UTC, original submission:  

string.h contains the following lines:

# define _ATTR_CONST_ __attribute__((_const_))
extern int ffsll (long long _val) __ATTR_CONST_;

long long is available since C99. Consequently, compiling or syntax-checking the above line with C90 may run into

error: ISO C90 does not support 'long long' [-Wlong-long]

This is particularly inconvenient in the avr-gcc testsuite, for example, because it's not appropriate to add -Wno-long-long to the testsuite or use similar hacks.

Such prototypes should be shielded against C90 by, say,

#if defined _STDC_VERSION_ \
    && _STDC_VERSION_ >= 199900 \
    && !defined __cplusplus

or similar.

Likewise for other places that use long long, if any.

Georg-Johann Lay <gjlayde>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by gjlayde (Submitted the item)
  •  

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-05-14 joerg_wunsch StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 1.8.1
    2012-05-12 joerg_wunsch StatusNone In Progress
        Assigned toNone joerg_wunsch

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code