dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dejagnu.h and GCC 5's change to -std=gnu11


From: David Malcolm
Subject: dejagnu.h and GCC 5's change to -std=gnu11
Date: Wed, 22 Oct 2014 04:10:26 -0400

I ran into an incompatibility between <dejagnu.h> and GCC 5 (or, at
least, current trunk of gcc), in which the inline functions in dejagnu.h
can't be seen at link time:

$ cat ../../test-dg-api.c

#include <dejagnu.h>

int
main (int argc, char **argv)
{
  pass ("got here");
  return 0;
}

With gcc r216247 onwards:
  $ ./xgcc -B. \
      ../../test-dg-api.c -o test-dg-api
  /tmp/ccc7PdfM.o: In function `main':
  test-dg-api.c:(.text+0x21): undefined reference to `pass'
  collect2: error: ld returned 1 exit status
and the generated asm doesn't contain an implementation of "pass".

I filed it as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63613

It turns out to be because gcc 5 is changing the default mode for C from
-std=gnu89 to -std=gnu11.

Quoting a comment in the bug report:
> That means dejagnu.h assumes the GNU inline semantics, but
> doesn't use __gnu_inline__ attribute.  So, either compile with
> -fgnu89-inline, or get dejagnu.h fixed.

Indeed, adding "-fgnu89-inline" to the gcc invocation fixes the issue:
  $ ./xgcc -B. \
       -fgnu89-inline \
       ../../test-dg-api.c -o test-dg-api
  $ ./test-dg-api 
        PASSED: got here

Hope this is helpful
Dave





reply via email to

[Prev in Thread] Current Thread [Next in Thread]