From: Paul Eggert Date: Tue, 15 Mar 2016 20:47:47 +0000 (-0700) Subject: Port to clang 3.7.0 on x86-64 X-Git-Tag: emacs-25.0.93~89^2~61 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/7950e1dd3fc1ce07cc4d6001de6c11a249b80de8 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. --- diff --git a/configure.ac b/configure.ac index 075f6119ea..d31b8df2b0 100644 --- a/configure.ac +++ b/configure.ac @@ -877,18 +877,19 @@ AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], # When compiling with GCC, prefer -isystem to -I when including system # include files, to avoid generating useless diagnostics for the files. -if test "$gl_gcc_warnings" != yes; then +AS_IF([test "$gl_gcc_warnings" != yes], + [ isystem='-I' - if test "$emacs_cv_clang" = yes - then + AS_IF([test "$emacs_cv_clang" = yes], + [ # Turn off some warnings if supported. gl_WARN_ADD([-Wno-switch]) gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) gl_WARN_ADD([-Wno-pointer-sign]) gl_WARN_ADD([-Wno-string-plus-int]) gl_WARN_ADD([-Wno-unknown-attributes]) - fi -else + ]) + ],[ isystem='-isystem ' # This, $nw, is the list of warnings we disable. @@ -899,10 +900,9 @@ else # Old toolkits mishandle 'const'. nw="$nw -Wwrite-strings" ;; - *) - gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) - ;; esac + AS_IF([test -z "$nw"], + [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) AC_SUBST([WERROR_CFLAGS]) nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings @@ -985,7 +985,7 @@ else gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) -fi + ]) edit_cflags=" s,///*,/,g diff --git a/src/editfns.c b/src/editfns.c index df98223497..2ac0537edd 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1456,7 +1456,7 @@ time_overflow (void) error ("Specified time is not representable"); } -static void +static _Noreturn void invalid_time (void) { error ("Invalid time specification"); @@ -1848,7 +1848,9 @@ lisp_time_struct (Lisp_Object specified_time, int *plen) Lisp_Object high, low, usec, psec; struct lisp_time t; int len = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec); - int val = len ? decode_time_components (high, low, usec, psec, &t, 0) : 0; + if (!len) + invalid_time (); + int val = decode_time_components (high, low, usec, psec, &t, 0); check_time_validity (val); *plen = len; return t; diff --git a/src/xfns.c b/src/xfns.c index 0a4a09ef28..b22af5c830 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -273,7 +273,7 @@ x_real_pos_and_offsets (struct frame *f, XFree (tmp_children); #endif - if (wm_window == rootw || had_errors) + if (had_errors || wm_window == rootw) break; win = wm_window;