Opened 10 years ago

Closed 9 years ago

#222 closed defect (fixed)

gcc 4.3 semantic change of extern inline

Reported by: Yuri Dario Owned by: bird
Priority: normal Milestone: libc-0.6.4
Component: libc-frontend Version: 0.6.2
Severity: normal Keywords:
Cc:

Description

When compiling with -std=c99 or -std=gnu99, the extern inline keywords changes meaning. GCC 4.3 conforms to the ISO C99 specification, where extern inline is very different thing than the GNU extern inline extension.

If the old GNU extern inline behavior is desired, one can use extern inline attribute((gnu_inline)).

Only stdio.h have this problem.

Link: http://gcc.gnu.org/gcc-4.3/porting_to.html

Attachments (1)

stdio.diff (583 bytes) - added by KO Myung-Hun 10 years ago.
patch for stdio.h

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by Yuri Dario

Current patch to stdio.h

--- stdio.h.orig	Sun Jun 10 15:44:44 2007
+++ stdio.h	Sat Aug 28 15:43:52 2010
@@ -526,18 +526,18 @@
 int _flush (int, FILE *);
 int _rmtmp (void);
 
-extern __inline__ int feof (FILE *_s)
+extern inline __attribute__((__gnu_inline__)) int feof (FILE *_s)
 {
   return (_s->_flags & _IOEOF ? 1 : 0);
 }
 
-extern __inline__ int ferror (FILE *_s)
+extern inline __attribute__((__gnu_inline__)) int ferror (FILE *_s)
 {
   return (_s->_flags & _IOERR ? 1 : 0);
 }
 
-extern __inline__ int getchar (void) { return getc (stdin); }
-extern __inline__ int putchar (int _c) { return putc (_c, stdout); }
+extern inline __attribute__((__gnu_inline__)) int getchar (void) { return getc (stdin); }
+extern inline __attribute__((__gnu_inline__)) int putchar (int _c) { return putc (_c, stdout); }
 
 #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) || defined(__USE_EMX)
 

comment:2 Changed 10 years ago by bird

Component: gcclibc-frontend
Status: newassigned

The patch isn't quite right as we cannot use 'inline' in C headers, it must be 'inline'. The right thing to do here probably static inline func() {}'.

comment:3 Changed 10 years ago by Yuri Dario

I built a lot of code using above changes, from basic libs to full applications.

Changed 10 years ago by KO Myung-Hun

Attachment: stdio.diff added

patch for stdio.h

comment:4 Changed 10 years ago by KO Myung-Hun

The above patch is the one being shipped with gcc4 in very first place.

See http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Inline.html#Inline

comment:5 Changed 9 years ago by bird

Resolution: fixed
Status: assignedclosed

(In [3714]) 0.6: Backported r3712 & r3713: stdio.h,features.h: Don't use gcc's 'extern inline' feature with 4.3.0 and later. Fixes #222.

Note: See TracTickets for help on using tickets.