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

 
 

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

Submitted by:  Georg-Johann Lay <gjlayde>
Submitted on:  Sat 12 May 2012 08:27:10 AM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedPercent Complete: 0%
Assigned to: Joerg Wunsch <joerg_wunsch>Open/Closed: Closed
Release: 1.8.0Fixed Release: 1.8.1

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 14 May 2012 03:39:39 PM UTCjoerg_wunschStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>1.8.1
    Sat 12 May 2012 09:15:47 AM UTCjoerg_wunschStatusNone=>In Progress
      Assigned toNone=>joerg_wunsch

    Back to the top


    Powered by Savane 3.1-cleanup1