]> code.delx.au - gnu-emacs/commitdiff
Port to clang 3.7.0 on x86-64
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 15 Mar 2016 20:47:47 +0000 (13:47 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 15 Mar 2016 20:49:58 +0000 (13:49 -0700)
* 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.

configure.ac
src/editfns.c
src/xfns.c

index 075f6119ead7c837ba502730048b5d7ad5b5411e..d31b8df2b04de5cc66de431084f1aca23ff42bcf 100644 (file)
@@ -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
index df98223497755d1f7053c1af45bf83877a56646f..2ac0537eddbdd1f9268d2ff2bc291d858e0ccfc7 100644 (file)
@@ -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;
index 0a4a09ef285f635dc42a77867cf34073ba9a45b9..b22af5c830d0debd05865dcc2c22dbf0e0dd8f36 100644 (file)
@@ -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;