This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gcc-in-cxx] Use plain inline, not extern inline, for C++
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 06 Mar 2009 15:37:04 -0800
- Subject: [gcc-in-cxx] Use plain inline, not extern inline, for C++
I committed this patch to the gcc-in-cxx branch to use plain inline, not
extern inline, when compiling C++ code.
Ian
2009-03-06 Ian Lance Taylor <iant@google.com>
* toplev.h (floor_log2, exact_log2): Don't define as extern for
C++.
Index: toplev.h
===================================================================
--- toplev.h (revision 144620)
+++ toplev.h (working copy)
@@ -177,11 +177,13 @@ extern void decode_d_option (const char
extern bool fast_math_flags_set_p (void);
extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
+#ifndef __cplusplus
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);
/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
+#endif
/* Inline versions of the above for speed. */
#if GCC_VERSION >= 3004
@@ -196,13 +198,19 @@ extern int floor_log2 (
# define CTZ_HWI __builtin_ctz
# endif
-extern inline int
+#ifndef __cplusplus
+extern
+#endif
+inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}
-extern inline int
+#ifndef __cplusplus
+extern
+#endif
+inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;