poke-devel
[Top][All Lists]
Advanced

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

jitter and GCC < 4.6


From: Bruno Haible
Subject: jitter and GCC < 4.6
Date: Sun, 28 Feb 2021 21:07:23 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

I'm trying to install poke on Linux/alpha. The compiler is GCC 4.2.4.
I get compilation errors:

libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../libpoke -I../poke 
-I../gl-libpoke -I../../gl-libpoke -I../../common -DPKL_DEBUG 
-DPKGDATADIR=\"/home/bruno/share/poke\" -DPKGINFODIR=\"/home/bruno/share/info\" 
-DLOCALEDIR=\"/home/bruno/share/locale\" -fvisibility=hidden -DBUILDING_LIBPOKE 
-DJITTER_DISPATCH_DIRECT_THREADING=1 -I /home/bruno/poke-1.0a/jitter -I 
/home/bruno/poke-1.0a/build/jitter -I 
/home/bruno/poke-1.0a/jitter/machine/dummy -I /home/bruno/include 
-DJITTER_DISPATCH_DIRECT_THREADING=1 -I /home/bruno/poke-1.0a/jitter -I 
/home/bruno/poke-1.0a/build/jitter -I 
/home/bruno/poke-1.0a/jitter/machine/dummy -I /home/bruno/include 
-I/home/bruno/include -Wall -mieee -Wall -O2 -fomit-frame-pointer 
-fno-reorder-functions -g0 -fno-var-tracking -fno-reorder-functions -g -O2 -MT 
libpvmjitter_la-pvm-vm2.lo -MD -MP -MF .deps/libpvmjitter_la-pvm-vm2.Tpo -c 
../../libpoke/pvm-vm2.c  -fPIC -DPIC -o .libs/libpvmjitter_la-pvm-vm2.o
In file included from ../../libpoke/pvm.jitter:178:
../../libpoke/pvm-alloc.h:47: warning: 'alloc_size' attribute directive ignored
../../libpoke/pvm-alloc.h:55: warning: 'alloc_size' attribute directive ignored
In file included from 
/home/bruno/poke-1.0a/jitter/jitter/jitter-instruction.h:33,
                 from ../../libpoke/pvm.jitter:182:
/home/bruno/poke-1.0a/jitter/jitter/jitter-hash.h:162: warning: type qualifiers 
ignored on function return type
/home/bruno/poke-1.0a/jitter/jitter/jitter-hash.h:221: warning: 'cold' 
attribute directive ignored
/home/bruno/poke-1.0a/jitter/jitter/jitter-hash.h:239: warning: type qualifiers 
ignored on function return type
/home/bruno/poke-1.0a/jitter/jitter/jitter-hash.h:272: warning: type qualifiers 
ignored on function return type
../../libpoke/pvm.jitter:714: warning: 'noclone' attribute directive ignored
../../libpoke/pvm.jitter: In function 'pvm_execute_or_initialize':
../../libpoke/pvm.jitter:2174: error: #pragma GCC diagnostic not allowed inside 
functions
../../libpoke/pvm.jitter:2175: error: #pragma GCC diagnostic not allowed inside 
functions
../../libpoke/pvm.jitter:2449: error: #pragma GCC diagnostic not allowed inside 
functions
../../libpoke/pvm.jitter:2450: error: #pragma GCC diagnostic not allowed inside 
functions
../../libpoke/pvm.jitter:2456: error: #pragma GCC diagnostic not allowed inside 
functions
../../libpoke/pvm.jitter:2579: warning: 'hot' attribute directive ignored
../../libpoke/pvm.jitter:3257: warning: 'cold' attribute directive ignored
...

The reason is that GCC versions >= 4.2, < 4.6 don't support
'#pragma GCC diagnostic' inside functions:

$ gcc-version 4.7.3 -S foo.c
$ gcc-version 4.6.4 -S foo.c
$ gcc-version 4.5.4 -S foo.c
foo.c: In function 'foo':
foo.c:2:9: error: #pragma GCC diagnostic not allowed inside functions
$ gcc-version 4.4.7 -S foo.c
foo.c: In function 'foo':
foo.c:2: error: #pragma GCC diagnostic not allowed inside functions
$ gcc-version 4.3.6 -S foo.c
foo.c: In function 'foo':
foo.c:2: error: #pragma GCC diagnostic not allowed inside functions
$ gcc-version 4.2.4 -S foo.c
foo.c: In function 'foo':
foo.c:2: error: #pragma GCC diagnostic not allowed inside functions
$ gcc-version 4.1.2 -S foo.c
$ gcc-version 4.0.4 -S foo.c

The fix is simply to make these '#pragma GCC diagnostic ...' directives
only to GCC versions that support it. I chose only GCC >= 4.6, since
no one cares about warnings from GCC < 4.2. So, here's a proposed patch.

Btw, is it intentional that the first '#pragma GCC diagnostic push'
is outside a '#ifdef JITTER_REPLICATE' but the corresponding
'#pragma GCC diagnostic pop' is inside '#ifdef JITTER_REPLICATE'?

Attachment: 0001-Fix-a-compilation-error-with-GCC-versions-4.2-4.6.patch
Description: Text Data


reply via email to

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