diff options
| author | Paul Eggert | 2016-03-15 13:47:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-03-15 13:49:58 -0700 |
| commit | 7950e1dd3fc1ce07cc4d6001de6c11a249b80de8 (patch) | |
| tree | 75e155ac82d6297a7a42d3116f6028a1b807cd46 | |
| parent | 218ae59019204311101b1d6f79c86f8815b3a65b (diff) | |
| download | emacs-7950e1dd3fc1ce07cc4d6001de6c11a249b80de8.tar.gz emacs-7950e1dd3fc1ce07cc4d6001de6c11a249b80de8.zip | |
Port to clang 3.7.0 on x86-64
* configure.ac: Use AS_IF so that gl_WARN_ADD’s prerequisites are
not done conditionally. This helps clang, which needs
-Wunknown-warning-option later when configured with warnings.
* src/editfns.c (invalid_time): Now _Noreturn, since clang isn’t
smart enough to figure this out on its own if warnings are enabled.
(lisp_time_struct): Redo for clarity, and to pacify clang.
* src/xfns.c (x_real_pos_and_offsets) [USE_XCB]: Don’t use
uninitialized locals. This avoids undefined behavior and pacifies
clang.
| -rw-r--r-- | configure.ac | 18 | ||||
| -rw-r--r-- | src/editfns.c | 6 | ||||
| -rw-r--r-- | src/xfns.c | 2 |
3 files changed, 14 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 075f6119ead..d31b8df2b04 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -877,18 +877,19 @@ AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], | |||
| 877 | 877 | ||
| 878 | # When compiling with GCC, prefer -isystem to -I when including system | 878 | # When compiling with GCC, prefer -isystem to -I when including system |
| 879 | # include files, to avoid generating useless diagnostics for the files. | 879 | # include files, to avoid generating useless diagnostics for the files. |
| 880 | if test "$gl_gcc_warnings" != yes; then | 880 | AS_IF([test "$gl_gcc_warnings" != yes], |
| 881 | [ | ||
| 881 | isystem='-I' | 882 | isystem='-I' |
| 882 | if test "$emacs_cv_clang" = yes | 883 | AS_IF([test "$emacs_cv_clang" = yes], |
| 883 | then | 884 | [ |
| 884 | # Turn off some warnings if supported. | 885 | # Turn off some warnings if supported. |
| 885 | gl_WARN_ADD([-Wno-switch]) | 886 | gl_WARN_ADD([-Wno-switch]) |
| 886 | gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) | 887 | gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) |
| 887 | gl_WARN_ADD([-Wno-pointer-sign]) | 888 | gl_WARN_ADD([-Wno-pointer-sign]) |
| 888 | gl_WARN_ADD([-Wno-string-plus-int]) | 889 | gl_WARN_ADD([-Wno-string-plus-int]) |
| 889 | gl_WARN_ADD([-Wno-unknown-attributes]) | 890 | gl_WARN_ADD([-Wno-unknown-attributes]) |
| 890 | fi | 891 | ]) |
| 891 | else | 892 | ],[ |
| 892 | isystem='-isystem ' | 893 | isystem='-isystem ' |
| 893 | 894 | ||
| 894 | # This, $nw, is the list of warnings we disable. | 895 | # This, $nw, is the list of warnings we disable. |
| @@ -899,10 +900,9 @@ else | |||
| 899 | # Old toolkits mishandle 'const'. | 900 | # Old toolkits mishandle 'const'. |
| 900 | nw="$nw -Wwrite-strings" | 901 | nw="$nw -Wwrite-strings" |
| 901 | ;; | 902 | ;; |
| 902 | *) | ||
| 903 | gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) | ||
| 904 | ;; | ||
| 905 | esac | 903 | esac |
| 904 | AS_IF([test -z "$nw"], | ||
| 905 | [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) | ||
| 906 | AC_SUBST([WERROR_CFLAGS]) | 906 | AC_SUBST([WERROR_CFLAGS]) |
| 907 | 907 | ||
| 908 | nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings | 908 | nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings |
| @@ -985,7 +985,7 @@ else | |||
| 985 | 985 | ||
| 986 | gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) | 986 | gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) |
| 987 | AC_SUBST([GNULIB_WARN_CFLAGS]) | 987 | AC_SUBST([GNULIB_WARN_CFLAGS]) |
| 988 | fi | 988 | ]) |
| 989 | 989 | ||
| 990 | edit_cflags=" | 990 | edit_cflags=" |
| 991 | s,///*,/,g | 991 | s,///*,/,g |
diff --git a/src/editfns.c b/src/editfns.c index df982234977..2ac0537eddb 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1456,7 +1456,7 @@ time_overflow (void) | |||
| 1456 | error ("Specified time is not representable"); | 1456 | error ("Specified time is not representable"); |
| 1457 | } | 1457 | } |
| 1458 | 1458 | ||
| 1459 | static void | 1459 | static _Noreturn void |
| 1460 | invalid_time (void) | 1460 | invalid_time (void) |
| 1461 | { | 1461 | { |
| 1462 | error ("Invalid time specification"); | 1462 | error ("Invalid time specification"); |
| @@ -1848,7 +1848,9 @@ lisp_time_struct (Lisp_Object specified_time, int *plen) | |||
| 1848 | Lisp_Object high, low, usec, psec; | 1848 | Lisp_Object high, low, usec, psec; |
| 1849 | struct lisp_time t; | 1849 | struct lisp_time t; |
| 1850 | int len = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec); | 1850 | int len = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec); |
| 1851 | int val = len ? decode_time_components (high, low, usec, psec, &t, 0) : 0; | 1851 | if (!len) |
| 1852 | invalid_time (); | ||
| 1853 | int val = decode_time_components (high, low, usec, psec, &t, 0); | ||
| 1852 | check_time_validity (val); | 1854 | check_time_validity (val); |
| 1853 | *plen = len; | 1855 | *plen = len; |
| 1854 | return t; | 1856 | return t; |
diff --git a/src/xfns.c b/src/xfns.c index 0a4a09ef285..b22af5c830d 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -273,7 +273,7 @@ x_real_pos_and_offsets (struct frame *f, | |||
| 273 | XFree (tmp_children); | 273 | XFree (tmp_children); |
| 274 | #endif | 274 | #endif |
| 275 | 275 | ||
| 276 | if (wm_window == rootw || had_errors) | 276 | if (had_errors || wm_window == rootw) |
| 277 | break; | 277 | break; |
| 278 | 278 | ||
| 279 | win = wm_window; | 279 | win = wm_window; |