diff options
| author | Paul Eggert | 2018-08-05 17:40:22 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-05 17:40:48 -0700 |
| commit | ba8eb994f86206f69cbf9743a67b9d86ef9b1d8f (patch) | |
| tree | 2ea9d68624a5061629897ef28116ca528f6c8cd2 | |
| parent | 56683b139b8480198b167ef61cf1b32c528d1070 (diff) | |
| download | emacs-ba8eb994f86206f69cbf9743a67b9d86ef9b1d8f.tar.gz emacs-ba8eb994f86206f69cbf9743a67b9d86ef9b1d8f.zip | |
Update from gnulib
This incorporates:
2018-08-05 Fix link error regarding 'rpl_environ'
* build-aux/config.guess, lib/unistd.in.h, lib/warn-on-use.h:
* m4/extern-inline.m4: Copy from Gnulib.
| -rwxr-xr-x | build-aux/config.guess | 4 | ||||
| -rw-r--r-- | lib/unistd.in.h | 4 | ||||
| -rw-r--r-- | lib/warn-on-use.h | 64 | ||||
| -rw-r--r-- | m4/extern-inline.m4 | 16 |
4 files changed, 61 insertions, 27 deletions
diff --git a/build-aux/config.guess b/build-aux/config.guess index ba6af63cc44..d4fb3213ec7 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Attempt to guess a canonical system name. | 2 | # Attempt to guess a canonical system name. |
| 3 | # Copyright 1992-2018 Free Software Foundation, Inc. | 3 | # Copyright 1992-2018 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | timestamp='2018-07-18' | 5 | timestamp='2018-08-02' |
| 6 | 6 | ||
| 7 | # This file is free software; you can redistribute it and/or modify it | 7 | # This file is free software; you can redistribute it and/or modify it |
| 8 | # under the terms of the GNU General Public License as published by | 8 | # under the terms of the GNU General Public License as published by |
| @@ -126,7 +126,7 @@ set_cc_for_build() { | |||
| 126 | 126 | ||
| 127 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe. | 127 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe. |
| 128 | # (ghazi@noc.rutgers.edu 1994-08-24) | 128 | # (ghazi@noc.rutgers.edu 1994-08-24) |
| 129 | if (test -f /.attbin/uname) >/dev/null 2>&1 ; then | 129 | if test -f /.attbin/uname ; then |
| 130 | PATH=$PATH:/.attbin ; export PATH | 130 | PATH=$PATH:/.attbin ; export PATH |
| 131 | fi | 131 | fi |
| 132 | 132 | ||
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index b6a348f5297..55bbb6ca3b7 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -432,12 +432,12 @@ extern char **environ; | |||
| 432 | #elif defined GNULIB_POSIXCHECK | 432 | #elif defined GNULIB_POSIXCHECK |
| 433 | # if HAVE_RAW_DECL_ENVIRON | 433 | # if HAVE_RAW_DECL_ENVIRON |
| 434 | _GL_UNISTD_INLINE char *** | 434 | _GL_UNISTD_INLINE char *** |
| 435 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " | ||
| 436 | "use gnulib module environ for portability") | ||
| 435 | rpl_environ (void) | 437 | rpl_environ (void) |
| 436 | { | 438 | { |
| 437 | return &environ; | 439 | return &environ; |
| 438 | } | 440 | } |
| 439 | _GL_WARN_ON_USE (rpl_environ, "environ is unportable - " | ||
| 440 | "use gnulib module environ for portability"); | ||
| 441 | # undef environ | 441 | # undef environ |
| 442 | # define environ (*rpl_environ ()) | 442 | # define environ (*rpl_environ ()) |
| 443 | # endif | 443 | # endif |
diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index e76c38427d5..72d67cc2348 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h | |||
| @@ -20,23 +20,32 @@ | |||
| 20 | supported by the compiler. If the compiler does not support this | 20 | supported by the compiler. If the compiler does not support this |
| 21 | feature, the macro expands to an unused extern declaration. | 21 | feature, the macro expands to an unused extern declaration. |
| 22 | 22 | ||
| 23 | This macro is useful for marking a function as a potential | 23 | _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the |
| 24 | attribute used in _GL_WARN_ON_USE. If the compiler does not support | ||
| 25 | this feature, it expands to empty. | ||
| 26 | |||
| 27 | These macros are useful for marking a function as a potential | ||
| 24 | portability trap, with the intent that "literal string" include | 28 | portability trap, with the intent that "literal string" include |
| 25 | instructions on the replacement function that should be used | 29 | instructions on the replacement function that should be used |
| 26 | instead. However, one of the reasons that a function is a | 30 | instead. |
| 27 | portability trap is if it has the wrong signature. Declaring | 31 | _GL_WARN_ON_USE is for functions with 'extern' linkage. |
| 28 | FUNCTION with a different signature in C is a compilation error, so | 32 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' |
| 29 | this macro must use the same type as any existing declaration so | 33 | linkage. |
| 30 | that programs that avoid the problematic FUNCTION do not fail to | 34 | |
| 31 | compile merely because they included a header that poisoned the | 35 | However, one of the reasons that a function is a portability trap is |
| 32 | function. But this implies that _GL_WARN_ON_USE is only safe to | 36 | if it has the wrong signature. Declaring FUNCTION with a different |
| 33 | use if FUNCTION is known to already have a declaration. Use of | 37 | signature in C is a compilation error, so this macro must use the |
| 34 | this macro implies that there must not be any other macro hiding | 38 | same type as any existing declaration so that programs that avoid |
| 35 | the declaration of FUNCTION; but undefining FUNCTION first is part | 39 | the problematic FUNCTION do not fail to compile merely because they |
| 36 | of the poisoning process anyway (although for symbols that are | 40 | included a header that poisoned the function. But this implies that |
| 37 | provided only via a macro, the result is a compilation error rather | 41 | _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already |
| 38 | than a warning containing "literal string"). Also note that in | 42 | have a declaration. Use of this macro implies that there must not |
| 39 | C++, it is only safe to use if FUNCTION has no overloads. | 43 | be any other macro hiding the declaration of FUNCTION; but |
| 44 | undefining FUNCTION first is part of the poisoning process anyway | ||
| 45 | (although for symbols that are provided only via a macro, the result | ||
| 46 | is a compilation error rather than a warning containing | ||
| 47 | "literal string"). Also note that in C++, it is only safe to use if | ||
| 48 | FUNCTION has no overloads. | ||
| 40 | 49 | ||
| 41 | For an example, it is possible to poison 'getline' by: | 50 | For an example, it is possible to poison 'getline' by: |
| 42 | - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], | 51 | - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], |
| @@ -54,12 +63,21 @@ | |||
| 54 | (less common usage, like &environ, will cause a compilation error | 63 | (less common usage, like &environ, will cause a compilation error |
| 55 | rather than issue the nice warning, but the end result of informing | 64 | rather than issue the nice warning, but the end result of informing |
| 56 | the developer about their portability problem is still achieved): | 65 | the developer about their portability problem is still achieved): |
| 57 | #if HAVE_RAW_DECL_ENVIRON | 66 | #if HAVE_RAW_DECL_ENVIRON |
| 58 | static char ***rpl_environ (void) { return &environ; } | 67 | static char *** |
| 59 | _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); | 68 | rpl_environ (void) { return &environ; } |
| 60 | # undef environ | 69 | _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); |
| 61 | # define environ (*rpl_environ ()) | 70 | # undef environ |
| 62 | #endif | 71 | # define environ (*rpl_environ ()) |
| 72 | #endif | ||
| 73 | or better (avoiding contradictory use of 'static' and 'extern'): | ||
| 74 | #if HAVE_RAW_DECL_ENVIRON | ||
| 75 | static char *** | ||
| 76 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") | ||
| 77 | rpl_environ (void) { return &environ; } | ||
| 78 | # undef environ | ||
| 79 | # define environ (*rpl_environ ()) | ||
| 80 | #endif | ||
| 63 | */ | 81 | */ |
| 64 | #ifndef _GL_WARN_ON_USE | 82 | #ifndef _GL_WARN_ON_USE |
| 65 | 83 | ||
| @@ -67,13 +85,17 @@ | |||
| 67 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | 85 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ |
| 68 | # define _GL_WARN_ON_USE(function, message) \ | 86 | # define _GL_WARN_ON_USE(function, message) \ |
| 69 | extern __typeof__ (function) function __attribute__ ((__warning__ (message))) | 87 | extern __typeof__ (function) function __attribute__ ((__warning__ (message))) |
| 88 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
| 89 | __attribute__ ((__warning__ (message))) | ||
| 70 | # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING | 90 | # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING |
| 71 | /* Verify the existence of the function. */ | 91 | /* Verify the existence of the function. */ |
| 72 | # define _GL_WARN_ON_USE(function, message) \ | 92 | # define _GL_WARN_ON_USE(function, message) \ |
| 73 | extern __typeof__ (function) function | 93 | extern __typeof__ (function) function |
| 94 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 74 | # else /* Unsupported. */ | 95 | # else /* Unsupported. */ |
| 75 | # define _GL_WARN_ON_USE(function, message) \ | 96 | # define _GL_WARN_ON_USE(function, message) \ |
| 76 | _GL_WARN_EXTERN_C int _gl_warn_on_use | 97 | _GL_WARN_EXTERN_C int _gl_warn_on_use |
| 98 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
| 77 | # endif | 99 | # endif |
| 78 | #endif | 100 | #endif |
| 79 | 101 | ||
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 index da8a2cc01c7..3661cbda5ed 100644 --- a/m4/extern-inline.m4 +++ b/m4/extern-inline.m4 | |||
| @@ -25,7 +25,8 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
| 25 | if isdigit is mistakenly implemented via a static inline function, | 25 | if isdigit is mistakenly implemented via a static inline function, |
| 26 | a program containing an extern inline function that calls isdigit | 26 | a program containing an extern inline function that calls isdigit |
| 27 | may not work since the C standard prohibits extern inline functions | 27 | may not work since the C standard prohibits extern inline functions |
| 28 | from calling static functions. This bug is known to occur on: | 28 | from calling static functions (ISO C 99 section 6.7.4.(3). |
| 29 | This bug is known to occur on: | ||
| 29 | 30 | ||
| 30 | OS X 10.8 and earlier; see: | 31 | OS X 10.8 and earlier; see: |
| 31 | https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html | 32 | https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html |
| @@ -38,7 +39,18 @@ AC_DEFUN([gl_EXTERN_INLINE], | |||
| 38 | 39 | ||
| 39 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and | 40 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and |
| 40 | for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. | 41 | for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. |
| 41 | Assume DragonFly and FreeBSD will be similar. */ | 42 | Assume DragonFly and FreeBSD will be similar. |
| 43 | |||
| 44 | GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 | ||
| 45 | inline semantics, unless -fgnu89-inline is used. It defines a macro | ||
| 46 | __GNUC_STDC_INLINE__ to indicate this situation or a macro | ||
| 47 | __GNUC_GNU_INLINE__ to indicate the opposite situation. | ||
| 48 | GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline | ||
| 49 | semantics but warns, unless -fgnu89-inline is used: | ||
| 50 | warning: C99 inline functions are not supported; using GNU89 | ||
| 51 | warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute | ||
| 52 | It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. | ||
| 53 | */ | ||
| 42 | #if (((defined __APPLE__ && defined __MACH__) \ | 54 | #if (((defined __APPLE__ && defined __MACH__) \ |
| 43 | || defined __DragonFly__ || defined __FreeBSD__) \ | 55 | || defined __DragonFly__ || defined __FreeBSD__) \ |
| 44 | && (defined __header_inline \ | 56 | && (defined __header_inline \ |