gcc-4.2 : regression for -std=gnu99

Bug #159923 reported by Erik de Castro Lopo
4
Affects Status Importance Assigned to Milestone
gcc-defaults (Suse)
Invalid
Undecided
Unassigned
gcc-defaults (Ubuntu)
Invalid
Undecided
Matthias Klose

Bug Description

I am compiling code with "gcc -std=gnu99". According to the gcc man page, gnu99 means the C99 standard with GNU (ie POSIX) extensions.

However, compiling something like:

   inline int plus_2 (int x) { return x + 2 ; }

results in the warning:

warning: C99 inline functions are not supported; using GNU89

I am not using gnu89, I'm using gnu99. This worked for gcc-4.1 and earlier.

Revision history for this message
Matthias Klose (doko) wrote :

Suse doesn't have a gcc-defaults package. Closing.

Changed in gcc-defaults:
status: New → Invalid
Revision history for this message
Matthias Klose (doko) wrote :

gnu99 is "ISO C99 plus GNU extensions"; please see http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Inline.html: "If you are writing a header file to be included in ISO C programs, write __inline__ instead of inline."

Changed in gcc-defaults:
assignee: nobody → doko
status: New → Invalid
Revision history for this message
Erik de Castro Lopo (erikd) wrote : Re: [Bug 159923] Re: gcc-4.2 : regression for -std=gnu99

Matthias Klose wrote:

> gnu99 is "ISO C99 plus GNU extensions"; please see
> http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Inline.html: "If you are
> writing a header file to be included in ISO C programs, write __inline__
> instead of inline."

I'm curious. Did you read my big report? If you read it and that was
your response, I really don't think you understood it.

From:

> https://bugs.launchpad.net/bugs/159923

  #> I am compiling code with "gcc -std=gnu99". According to the gcc
  #> man page, gnu99 means the C99 standard with GNU (ie POSIX) extensions.
  #>
  #> However, compiling something like:
  #>
  #> inline int plus_2 (int x) { return x + 2 ; }
  #>
  #> results in the warning:
  #>
  #> warning: C99 inline functions are not supported; using GNU89
  #>
  #> I am not using gnu89, I'm using gnu99. This worked for gcc-4.1 and earlier.

If I include include "-std=gnu99" and mention the man page which
states:

    gnu99 : ISO C99 plus GNU extensions.

I read that as meaning that gnu99 is a superset of C99 and hence
there should be no warning whatsoever for valid uses of the "inline"
keyword. Instead I get:

    warning: C99 inline functions are not supported; using GNU89

If gnu99 is a superset of C99 and C99 specifcally supports "inline",
why am I getting that warning for this program:

      inline int plus_2 (int x) { return x + 2 ; }
      int main (void) { return plus_2 (0) ; }

Note, there is no header file involved, just a single C implementation
file, a single standalone program.

Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"If you think C++ is not overly complicated, just what is a
protected abstract virtual base pure virtual private destructor
and when was the last time you needed one?" -- Tom Cargill

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.