]>
Commit | Line | Data |
---|---|---|
51ae354d JR |
1 | From: Mike Frysinger <vapier at gentoo dot org> |
2 | To: gcc-patches at gcc dot gnu dot org | |
3 | Subject: [PATCH] cfns: fix mismatch in gnu_inline attributes | |
4 | Date: Thu, 6 Aug 2015 23:47:06 -0400 | |
5 | Message-Id: <1438919226-30427-1-git-send-email-vapier@gentoo.org> | |
6 | ||
7 | Since the 3.0.3 release of gperf (made in May 2007), the generated func | |
8 | has had the gnu_inline attribute applied to it. The gcc source however | |
9 | has not been updated to include that which has lead to a mismatch. | |
10 | ||
11 | In practice, this hasn't been an issue for two reasons: | |
12 | (1) Before gcc-5, the default standard was (gnu) C89, and gcc does not | |
13 | warn or throw an error in this mode. | |
14 | (2) Starting with gcc-4.8, the compiler driver used to build gcc was | |
15 | changed to C++, and g++ does not warn or throw an error in this mode. | |
16 | ||
17 | This error does show up though when using gcc-5 to build gcc-4.7 or | |
18 | older as then the default is (gnu) C11 and the C compiler driver is | |
19 | used. That failure looks like: | |
20 | In file included from .../gcc-4.7.4/gcc/cp/except.c:990:0: | |
21 | cfns.gperf: At top level: | |
22 | cfns.gperf:101:1: error: 'gnu_inline' attribute present on 'libc_name_p' | |
23 | cfns.gperf:26:14: error: but not here | |
24 | ||
25 | Whether the compiler should always emit this error regardless of the | |
26 | active standard or compiler driver is debatable (I think it should be | |
27 | consistent -- either always do it or never do it). | |
28 | ||
29 | 2015-08-06 Mike Frysinger <vapier@gentoo.org> | |
30 | ||
31 | * cfns.gperf [__GNUC__, __GNUC_STDC_INLINE__]: Apply the | |
32 | __gnu_inline__ attribute. | |
33 | * cfns.h: Regenerated. | |
34 | --- | |
35 | gcc/cp/cfns.gperf | 3 +++ | |
36 | gcc/cp/cfns.h | 3 +++ | |
37 | 2 files changed, 6 insertions(+) | |
38 | ||
39 | diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf | |
40 | index 68acd3d..953262f 100644 | |
41 | --- a/gcc/cp/cfns.gperf | |
42 | +++ b/gcc/cp/cfns.gperf | |
43 | @@ -22,6 +22,9 @@ __inline | |
44 | static unsigned int hash (const char *, unsigned int); | |
45 | #ifdef __GNUC__ | |
46 | __inline | |
47 | +#ifdef __GNUC_STDC_INLINE__ | |
48 | +__attribute__ ((__gnu_inline__)) | |
49 | +#endif | |
50 | #endif | |
51 | const char * libc_name_p (const char *, unsigned int); | |
52 | %} | |
53 | diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h | |
54 | index 1c6665d..6d00c0e 100644 | |
55 | --- a/gcc/cp/cfns.h | |
56 | +++ b/gcc/cp/cfns.h | |
57 | @@ -53,6 +53,9 @@ __inline | |
58 | static unsigned int hash (const char *, unsigned int); | |
59 | #ifdef __GNUC__ | |
60 | __inline | |
61 | +#ifdef __GNUC_STDC_INLINE__ | |
62 | +__attribute__ ((__gnu_inline__)) | |
63 | +#endif | |
64 | #endif | |
65 | const char * libc_name_p (const char *, unsigned int); | |
66 | /* maximum key range = 391, duplicates = 0 */ | |
67 | -- | |
68 | 2.4.4 | |
69 |