Opened 14 years ago

Closed 14 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 14 years ago.
patch for stdio.h

Download all attachments as: .zip

Change History (6)

comment:1 by Yuri Dario, 14 years ago

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 by bird, 14 years ago

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 by Yuri Dario, 14 years ago

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

by KO Myung-Hun, 14 years ago

Attachment: stdio.diff added

patch for stdio.h

comment:4 by KO Myung-Hun, 14 years ago

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 by bird, 14 years ago

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.