From 5c4f0f47935386fd60e70deb452bb4422480d22f Mon Sep 17 00:00:00 2001 From: Bruce Korb Date: Sun, 4 Feb 2007 15:10:08 +0000 Subject: [PATCH] replace "extern" only if surrounded by space characters. From-SVN: r121574 --- fixincludes/ChangeLog | 5 ++ fixincludes/fixincl.x | 18 ++++--- fixincludes/inclhack.def | 73 +++++++++++++++----------- fixincludes/tests/base/sys/sysmacros.h | 5 +- 4 files changed, 62 insertions(+), 39 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 0149f62a2e0..b8c37a5e756 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,8 @@ +2007-02-03 Bruce Korb + + * inclhack.def (glibc_c99_inline_4): replace "extern" only if + surrounded by space characters. + 2007-01-25 Daniel Franke PR target/30272 diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 795b852d6d7..f97bdb63d85 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Monday January 15, 2007 at 09:38:13 PM CET + * It has been AutoGen-ed Sunday February 4, 2007 at 07:08:33 AM PST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Mo Jan 15 21:38:13 CET 2007 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Feb 4 07:08:34 PST 2007 * * You must regenerate it. Use the ./genfixes script. * @@ -2316,15 +2316,22 @@ tSCC zGlibc_C99_Inline_4List[] = */ #define apzGlibc_C99_Inline_4Machs (const char**)NULL +/* + * content selection pattern - do fix if pattern found + */ +tSCC zGlibc_C99_Inline_4Select0[] = + " extern "; + /* * content bypass pattern - skip fix if pattern found */ tSCC zGlibc_C99_Inline_4Bypass0[] = "__STDC_VERSION__"; -#define GLIBC_C99_INLINE_4_TEST_CT 1 +#define GLIBC_C99_INLINE_4_TEST_CT 2 static tTestDesc aGlibc_C99_Inline_4Tests[] = { - { TT_NEGREP, zGlibc_C99_Inline_4Bypass0, (regex_t*)NULL }, }; + { TT_NEGREP, zGlibc_C99_Inline_4Bypass0, (regex_t*)NULL }, + { TT_EGREP, zGlibc_C99_Inline_4Select0, (regex_t*)NULL }, }; /* * Fix Command Arguments for Glibc_C99_Inline_4 @@ -2335,7 +2342,6 @@ static const char* apzGlibc_C99_Inline_4Patch[] = { #if __STDC_VERSION__ < 19901L\n\ extern\n\ #endif\n", - "extern", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -8419,7 +8425,7 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 250 +#define REGEX_COUNT 251 #define MACH_LIST_SIZE_LIMIT 261 #define FIX_COUNT 207 diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 242f5af545f..24dc087f93b 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -654,7 +654,8 @@ fix = { */ fix = { hackname = alpha___extern_prefix; - select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n(#[ \t]*pragma[ \t]*extern_prefix.*)"; + select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n" + "(#[ \t]*pragma[ \t]*extern_prefix.*)"; mach = "alpha*-dec-osf*"; c_fix = format; @@ -681,7 +682,8 @@ fix = { c_fix = format; c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)"; - test_text = "#if (_ISO_C_SOURCE>=19990L) && !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)"; + test_text = "#if (_ISO_C_SOURCE>=19990L) " + "&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)"; }; @@ -714,7 +716,8 @@ fix = { select = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)'; c_fix = format; c_fix_arg = "%1(EX)"; - test_text = '#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))'; + test_text = '#define assert(EX) (((int) (EX)) ? (void)0 ' + ': __assert(#EX, __FILE__, __LINE__))'; }; @@ -782,14 +785,17 @@ fix = { fix = { hackname = alpha_pthread; files = pthread.h; - select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n" + select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)" + "|def _PTHREAD_ENV_DECC)(.*))\n" "(#[ \t]*define _PTHREAD_USE_PTDNAM_)"; mach = "alpha*-dec-osf*"; c_fix = format; - c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5"; + c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 " + "|| defined (__PRAGMA_EXTERN_PREFIX)\n%5"; - test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n" + test_text = "# if defined (_PTHREAD_ENV_DECC) " + "|| defined (_PTHREAD_ENV_EPCC)\n" "# define _PTHREAD_USE_PTDNAM_\n" "# endif\n" "# ifdef _PTHREAD_ENV_DECC\n" @@ -887,8 +893,12 @@ fix = { mach = "alpha*-dec-osf4*"; select = "#define wcstok wcstok_r"; - sed = "s@#define wcstok wcstok_r@extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__(\"wcstok_r\");@"; - sed = "s@#define wcsftime __wcsftime_isoc@extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__(\"__wcsftime_isoc\");@"; + sed = "s@#define wcstok wcstok_r@" + "extern wchar_t *wcstok __((wchar_t *, const wchar_t *, " + "wchar_t **)) __asm__(\"wcstok_r\");@"; + sed = "s@#define wcsftime __wcsftime_isoc@" + "extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *" + ", const struct tm *)) __asm__(\"__wcsftime_isoc\");@"; test_text = "#define wcstok wcstok_r\n" "#define wcsftime __wcsftime_isoc"; }; @@ -1320,21 +1330,21 @@ fix = { hackname = glibc_c99_inline_2; files = sys/stat.h, '*/sys/stat.h'; select = "extern __inline__ int"; - sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/" - "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" - "__inline__ int \\1/"; - sed = "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/" - "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" - "__inline__ int __REDIRECT\\1 (\\2/"; - sed = "s/^extern __inline__ int/" - "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" - "__inline__ int/"; + sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/" + "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" + "__inline__ int \\1/"; + sed = "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/" + "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" + "__inline__ int __REDIRECT\\1 (\\2/"; + sed = "s/^extern __inline__ int/" + "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n" + "__inline__ int/"; test_text = <<-EOT -extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); -extern __inline__ int -__NTH (fstat64 (int __fd, struct stat64 *__statbuf)) -{} -EOT; + extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); + extern __inline__ int + __NTH (fstat64 (int __fd, struct stat64 *__statbuf)) + {} + EOT; }; @@ -1346,12 +1356,12 @@ fix = { c_fix_arg = "# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L"; c_fix_arg = "^# ifdef __cplusplus$"; test_text = <<-EOT -# ifdef __cplusplus -# define __STRING_INLINE inline -# else -# define __STRING_INLINE extern __inline -# endif -EOT; + # ifdef __cplusplus + # define __STRING_INLINE inline + # else + # define __STRING_INLINE extern __inline + # endif + EOT; }; @@ -1359,12 +1369,13 @@ fix = { hackname = glibc_c99_inline_4; files = sys/sysmacros.h, '*/sys/sysmacros.h'; bypass = "__STDC_VERSION__"; + select = ' extern '; c_fix = format; c_fix_arg = "\n#if __STDC_VERSION__ < 19901L\nextern\n#endif\n"; - c_fix_arg = "extern"; test_text = <<-EOT -__extension__ extern __inline unsigned int -EOT; + __extension__ extern __inline unsigned int + __extension__ __extern_inline unsigned int + EOT; }; diff --git a/fixincludes/tests/base/sys/sysmacros.h b/fixincludes/tests/base/sys/sysmacros.h index 6891a675006..40c44f6183e 100644 --- a/fixincludes/tests/base/sys/sysmacros.h +++ b/fixincludes/tests/base/sys/sysmacros.h @@ -10,9 +10,10 @@ #if defined( GLIBC_C99_INLINE_4_CHECK ) -__extension__ +__extension__ #if __STDC_VERSION__ < 19901L extern #endif - __inline unsigned int +__inline unsigned int +__extension__ __extern_inline unsigned int #endif /* GLIBC_C99_INLINE_4_CHECK */ -- 2.30.2