summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-11-26 18:42:05 +0100
committerBruno Haible <bruno@clisp.org>2016-11-26 18:42:05 +0100
commita705809f3d2cfe02b3419662e3880458219a2e4a (patch)
treefcc093086699a85418fc970587584475b3bef328
parent0414be8ffff530414d6d652e930ff64ee1a508a6 (diff)
downloadgperf-a705809f3d2cfe02b3419662e3880458219a2e4a.tar.gz
Drop the inline specifiers from the generated lookup function.
-rw-r--r--ChangeLog16
-rw-r--r--src/output.cc21
-rw-r--r--tests/c-parse.exp6
-rw-r--r--tests/charsets.exp6
-rw-r--r--tests/chill.exp6
-rw-r--r--tests/cplusplus.exp6
-rw-r--r--tests/gpc.exp6
-rw-r--r--tests/incomplete.exp6
-rw-r--r--tests/java.exp6
-rw-r--r--tests/languages.exp6
-rw-r--r--tests/modula2.exp6
-rw-r--r--tests/objc.exp6
-rw-r--r--tests/permut2.exp6
-rw-r--r--tests/permut3.exp6
-rw-r--r--tests/permutc2.exp6
-rw-r--r--tests/test-4.exp6
16 files changed, 21 insertions, 100 deletions
diff --git a/ChangeLog b/ChangeLog
index 48c8d58..aa6e966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2016-11-26 Bruno Haible <bruno@clisp.org>
+ Drop the inline specifiers from the generated lookup function.
+ It's not adequate because
+ - this lookup function is quite large in fact, not worth inlining,
+ - with gcc -O0, it leads to link errors, see
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41194#c2>
+ - the hash function is 'static', the lookup function is non-static,
+ but references from non-static inline functions to static functions
+ and variables are forbidden, see ISO C 99 section 6.7.4.(3).
+ * src/output.cc (Output::output_lookup_function): Don't emit an inline
+ specifier.
+ * tests/*.exp: Update.
+ Reported by Sebastian Freundt and Sergii Strelkovskyi
+ at <https://savannah.gnu.org/bugs/?37071>.
+
+2016-11-26 Bruno Haible <bruno@clisp.org>
+
Change mailing list address to <bug-gperf@gnu.org>.
* src/output.cc (Output::output): Change bug report address to
<bug-gperf@gnu.org>.
diff --git a/src/output.cc b/src/output.cc
index 3174b8a..d8a8ba9 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -1974,22 +1974,11 @@ void
Output::output_lookup_function () const
{
/* Output the function's head. */
- if (option[KRC] | option[C] | option[ANSIC])
- /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
- inline semantics, unless -fgnu89-inline is used. It defines a macro
- __GNUC_STDC_INLINE__ to indicate this situation or a macro
- __GNUC_GNU_INLINE__ to indicate the opposite situation.
- GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
- semantics but warns, unless -fgnu89-inline is used:
- warning: C99 inline functions are not supported; using GNU89
- warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
- It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
- printf ("#ifdef __GNUC__\n"
- "__inline\n"
- "#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__\n"
- "__attribute__ ((__gnu_inline__))\n"
- "#endif\n"
- "#endif\n");
+ /* We don't declare the lookup function 'static' because we cannot make
+ assumptions about the compilation units of the user.
+ Since we don't make it 'static', it makes no sense to declare it 'inline',
+ because non-static inline functions must not reference static functions or
+ variables, see ISO C 99 section 6.7.4.(3). */
printf ("%s%s\n",
const_for_struct, _return_type);
diff --git a/tests/c-parse.exp b/tests/c-parse.exp
index f3d7d66..3b46a35 100644
--- a/tests/c-parse.exp
+++ b/tests/c-parse.exp
@@ -197,12 +197,6 @@ static struct resword wordlist[] =
{"volatile", TYPE_QUAL, RID_VOLATILE}
};
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
is_reserved_word (str, len)
register const char *str;
diff --git a/tests/charsets.exp b/tests/charsets.exp
index 6664230..2be2ddf 100644
--- a/tests/charsets.exp
+++ b/tests/charsets.exp
@@ -1801,12 +1801,6 @@ static const struct charset wordlist[] =
{"hp-desktop", 2021}
};
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const struct charset *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/chill.exp b/tests/chill.exp
index 1fdf1a0..faf4bd7 100644
--- a/tests/chill.exp
+++ b/tests/chill.exp
@@ -176,12 +176,6 @@ hash (str, len)
return hval;
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
in_word_set (str, len)
register const char *str;
diff --git a/tests/cplusplus.exp b/tests/cplusplus.exp
index e6e2c9a..148ad96 100644
--- a/tests/cplusplus.exp
+++ b/tests/cplusplus.exp
@@ -101,12 +101,6 @@ hash (str, len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
is_reserved_word (str, len)
register const char *str;
diff --git a/tests/gpc.exp b/tests/gpc.exp
index 3e416e2..63ba8b8 100644
--- a/tests/gpc.exp
+++ b/tests/gpc.exp
@@ -90,12 +90,6 @@ hash (register const char *str, register size_t len)
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
is_reserved_word (register const char *str, register size_t len)
{
diff --git a/tests/incomplete.exp b/tests/incomplete.exp
index d579ccf..e4dd037 100644
--- a/tests/incomplete.exp
+++ b/tests/incomplete.exp
@@ -80,12 +80,6 @@ hash (register const char *str, register size_t len)
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct month *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/java.exp b/tests/java.exp
index f79b616..44fa7ff 100644
--- a/tests/java.exp
+++ b/tests/java.exp
@@ -119,12 +119,6 @@ hash (str, len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct java_keyword *
java_keyword (str, len)
register const char *str;
diff --git a/tests/languages.exp b/tests/languages.exp
index 9c7aea0..2de2500 100644
--- a/tests/languages.exp
+++ b/tests/languages.exp
@@ -1458,12 +1458,6 @@ static const struct language wordlist[] =
{"ile", "Interlingue", 181, "interlingue", 181}
};
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const struct language *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/modula2.exp b/tests/modula2.exp
index 149f5e9..02001b7 100644
--- a/tests/modula2.exp
+++ b/tests/modula2.exp
@@ -107,12 +107,6 @@ hash (register const char *str, register size_t len)
return hval;
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const char *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/objc.exp b/tests/objc.exp
index 8fff614..2c3374b 100644
--- a/tests/objc.exp
+++ b/tests/objc.exp
@@ -93,12 +93,6 @@ hash (register const char *str, register size_t len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
is_reserved_word (register const char *str, register size_t len)
{
diff --git a/tests/permut2.exp b/tests/permut2.exp
index 45f2518..93e677b 100644
--- a/tests/permut2.exp
+++ b/tests/permut2.exp
@@ -80,12 +80,6 @@ hash (register const char *str, register size_t len)
return asso_values[(unsigned char)str[1]+1] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const char *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/permut3.exp b/tests/permut3.exp
index 0b26dd2..83e8564 100644
--- a/tests/permut3.exp
+++ b/tests/permut3.exp
@@ -80,12 +80,6 @@ hash (register const char *str, register size_t len)
return asso_values[(unsigned char)str[1]+1] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const char *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/permutc2.exp b/tests/permutc2.exp
index 11aa9e8..32aff6b 100644
--- a/tests/permutc2.exp
+++ b/tests/permutc2.exp
@@ -125,12 +125,6 @@ hash (register const char *str, register size_t len)
return asso_values[(unsigned char)str[1]+3] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const char *
in_word_set (register const char *str, register size_t len)
{
diff --git a/tests/test-4.exp b/tests/test-4.exp
index 090fbf7..af0a237 100644
--- a/tests/test-4.exp
+++ b/tests/test-4.exp
@@ -81,12 +81,6 @@ hash (register const char *str, register size_t len)
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
}
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
struct resword *
in_word_set (register const char *str, register size_t len)
{