Opened 15 years ago
Closed 15 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.
Attachments (1)
Change History (6)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Component: | gcc → libc-frontend |
|---|---|
| Status: | new → assigned |
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 , 15 years ago
I built a lot of code using above changes, from basic libs to full applications.
comment:4 by , 15 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

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)