This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove __GNUC__ conditions for "long long" from string.h and wchar.h


This patch removes __GNUC__ conditions from installed headers in two
places where the only GNU extension being conditioned is "long long",
so continuing the cleanup of cases where headers have compiler or
compiler version tests but it would be better to have either feature
tests or no compiler tests at all.

In the case of the first condition in wchar.h, "#if defined
__USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)", __USE_GNU
implies __USE_ISOC99 so the second part of the condition is completely
redundant and only __USE_ISOC99 needs checking at all.  As for the
second, given that __USE_GNU already implies other uses of long long
in this header, there seems no value in __GNUC__ conditionals on just
these particular uses.

In string.h this is the only use of long long.  But given that other
standard headers use long long with no guard beyond __USE_ISOC99 or
another feature test macro (look at various uses in stdlib.h, for
example), I don't think a special __GNUC__ conditional here is
useful.  (The various uses that *don't* check __GNUC__ or
__GLIBC_HAVE_LONG_LONG also illustrate why I don't think the
__GLIBC_HAVE_LONG_LONG tests are of practical use either.)

Tested x86_64.

2013-01-09  Joseph Myers  <joseph@codesourcery.com>

	* string/string.h [__USE_BSD && __USE_GNU && __GNUC__] (ffsll):
	Remove [__GNUC__] condition.
	* wcsmbs/wchar.h [__USE_ISOC99 || (__GNUC__ && __USE_GNU)]: Change
	condition to just [__USE_ISOC99].
	[__GNUC__ && __USE_GNU]: Change condition to just [__USE_GNU].

diff --git a/string/string.h b/string/string.h
index 4b3a686..ecc3fef 100644
--- a/string/string.h
+++ b/string/string.h
@@ -522,10 +522,8 @@ extern int ffs (int __i) __THROW __attribute__ ((__const__));
    platforms.  */
 # ifdef	__USE_GNU
 extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
-#  ifdef __GNUC__
 __extension__ extern int ffsll (long long int __ll)
      __THROW __attribute__ ((__const__));
-#  endif
 # endif
 
 /* Compare S1 and S2, ignoring case.  */
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 75e2dea..e915586 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -475,7 +475,7 @@ extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
      __THROW;
 __END_NAMESPACE_STD
 
-#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
+#ifdef __USE_ISOC99
 __BEGIN_NAMESPACE_C99
 /* Convert initial portion of wide string NPTR to `long long int'
    representation.  */
@@ -491,9 +491,9 @@ extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
 					wchar_t **__restrict __endptr,
 					int __base) __THROW;
 __END_NAMESPACE_C99
-#endif /* ISO C99 or GCC and GNU.  */
+#endif /* ISO C99.  */
 
-#if defined __GNUC__ && defined __USE_GNU
+#ifdef __USE_GNU
 /* Convert initial portion of wide string NPTR to `long long int'
    representation.  */
 __extension__
@@ -507,7 +507,7 @@ __extension__
 extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
 				       wchar_t **__restrict __endptr,
 				       int __base) __THROW;
-#endif /* GCC and use GNU.  */
+#endif /* Use GNU.  */
 
 #ifdef __USE_GNU
 /* The concept of one static locale per category is not very well

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]