aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-05-17 22:32:17 -0700
committerPaul Eggert2013-05-17 22:32:17 -0700
commit31ff141c226d00ce8c85562e7812ff1178cb45ed (patch)
tree129202655e89622c0ea695d2993e9134990d29bd /src
parentbfbe26276d04b1e8aeaec21fea7573ac1135d521 (diff)
downloademacs-31ff141c226d00ce8c85562e7812ff1178cb45ed.tar.gz
emacs-31ff141c226d00ce8c85562e7812ff1178cb45ed.zip
Port --enable-gcc-warnings to clang.
* configure.ac (nw): Remove obsolescent warnings. These aren't needed for clang, or for gcc for that matter. (emacs_cv_clang): New var, which tests for clang. Omit warnings that clang is too picky about. (GLIB_DISABLE_DEPRECATION_WARNINGS): Define this; needed for Ubuntu 13.04 + clang + --enable-gcc-warnings. * lib-src/etags.c: Omit unnecessary forward decls. (print_version, print_help): Declare _Noreturn. * lib-src/pop.c (socket_connection) [HAVE_GETADDRINFO]: Simplify. * src/bytecode.c (exec_byte_code): * src/regex.c: Redo diagnostic pragmas to pacify clang, too. * src/dbusbind.c (xd_retrieve_arg): Do not use uninitialized variable. * src/editfns.c (Fencode_time): * src/fileio.c (file_accessible_directory_p): * src/font.c (font_unparse_xlfd): Use '&"string"[index]' instead of '"string" + (index)'. * src/undo.c (user_error): Remove; unused.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/bytecode.c7
-rw-r--r--src/dbusbind.c2
-rw-r--r--src/editfns.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/font.c4
-rw-r--r--src/regex.c7
-rw-r--r--src/undo.c6
8 files changed, 28 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6909367dccb..e1f7a56aede 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12013-05-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port --enable-gcc-warnings to clang.
4 * bytecode.c (exec_byte_code):
5 * regex.c:
6 Redo diagnostic pragmas to pacify clang, too.
7 * dbusbind.c (xd_retrieve_arg): Do not use uninitialized variable.
8 * editfns.c (Fencode_time):
9 * fileio.c (file_accessible_directory_p):
10 * font.c (font_unparse_xlfd):
11 Use '&"string"[index]' instead of '"string" + (index)'.
12 * undo.c (user_error): Remove; unused.
13
12013-05-16 Eli Zaretskii <eliz@gnu.org> 142013-05-16 Eli Zaretskii <eliz@gnu.org>
2 15
3 * insdel.c (insert_1_both): Document the arguments, instead of 16 * insdel.c (insert_1_both): Document the arguments, instead of
diff --git a/src/bytecode.c b/src/bytecode.c
index 7676c8550a4..4940fd5c182 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -660,9 +660,12 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
660 the table clearer. */ 660 the table clearer. */
661#define LABEL(OP) [OP] = &&insn_ ## OP 661#define LABEL(OP) [OP] = &&insn_ ## OP
662 662
663#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 663#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
664# pragma GCC diagnostic push 664# pragma GCC diagnostic push
665# pragma GCC diagnostic ignored "-Woverride-init" 665# pragma GCC diagnostic ignored "-Woverride-init"
666#elif defined __clang__
667# pragma GCC diagnostic push
668# pragma GCC diagnostic ignored "-Winitializer-overrides"
666#endif 669#endif
667 670
668 /* This is the dispatch table for the threaded interpreter. */ 671 /* This is the dispatch table for the threaded interpreter. */
@@ -676,7 +679,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
676#undef DEFINE 679#undef DEFINE
677 }; 680 };
678 681
679#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 682#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__
680# pragma GCC diagnostic pop 683# pragma GCC diagnostic pop
681#endif 684#endif
682 685
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 863f7634eb5..3ec3c28431b 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -882,7 +882,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
882#endif 882#endif
883 { 883 {
884 dbus_uint32_t val; 884 dbus_uint32_t val;
885 unsigned int pval = val; 885 unsigned int pval;
886 dbus_message_iter_get_basic (iter, &val); 886 dbus_message_iter_get_basic (iter, &val);
887 pval = val; 887 pval = val;
888 XD_DEBUG_MESSAGE ("%c %u", dtype, pval); 888 XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
diff --git a/src/editfns.c b/src/editfns.c
index e0b0347fe69..cc6b4cff895 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1946,7 +1946,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1946 EMACS_INT zone_hr = abszone / (60*60); 1946 EMACS_INT zone_hr = abszone / (60*60);
1947 int zone_min = (abszone/60) % 60; 1947 int zone_min = (abszone/60) % 60;
1948 int zone_sec = abszone % 60; 1948 int zone_sec = abszone % 60;
1949 sprintf (tzbuf, tzbuf_format, "-" + (XINT (zone) < 0), 1949 sprintf (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
1950 zone_hr, zone_min, zone_sec); 1950 zone_hr, zone_min, zone_sec);
1951 tzstring = tzbuf; 1951 tzstring = tzbuf;
1952 } 1952 }
diff --git a/src/fileio.c b/src/fileio.c
index fe1bce16ca0..f20721251e6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2873,7 +2873,7 @@ file_accessible_directory_p (char const *file)
2873 and it's a safe optimization here. */ 2873 and it's a safe optimization here. */
2874 char *buf = SAFE_ALLOCA (len + 3); 2874 char *buf = SAFE_ALLOCA (len + 3);
2875 memcpy (buf, file, len); 2875 memcpy (buf, file, len);
2876 strcpy (buf + len, "/." + (file[len - 1] == '/')); 2876 strcpy (buf + len, &"/."[file[len - 1] == '/']);
2877 dir = buf; 2877 dir = buf;
2878 } 2878 }
2879 2879
diff --git a/src/font.c b/src/font.c
index ad601177b50..7bd44a5e52f 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1219,7 +1219,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1219 return -1; 1219 return -1;
1220 f[j] = p = alloca (alloc); 1220 f[j] = p = alloca (alloc);
1221 sprintf (p, "%s%s-*", SDATA (val), 1221 sprintf (p, "%s%s-*", SDATA (val),
1222 "*" + (SDATA (val)[SBYTES (val) - 1] == '*')); 1222 &"*"[SDATA (val)[SBYTES (val) - 1] == '*']);
1223 } 1223 }
1224 else 1224 else
1225 f[j] = SSDATA (val); 1225 f[j] = SSDATA (val);
@@ -1618,7 +1618,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1618 } 1618 }
1619 if (point_size > 0) 1619 if (point_size > 0)
1620 { 1620 {
1621 int len = snprintf (p, lim - p, "-%d" + (p == name), point_size); 1621 int len = snprintf (p, lim - p, &"-%d"[p == name], point_size);
1622 if (! (0 <= len && len < lim - p)) 1622 if (! (0 <= len && len < lim - p))
1623 return -1; 1623 return -1;
1624 p += len; 1624 p += len;
diff --git a/src/regex.c b/src/regex.c
index 04429386f84..79fb28ba12a 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -33,10 +33,9 @@
33 33
34/* Ignore some GCC warnings for now. This section should go away 34/* Ignore some GCC warnings for now. This section should go away
35 once the Emacs and Gnulib regex code is merged. */ 35 once the Emacs and Gnulib regex code is merged. */
36#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 36#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) || defined __clang__
37# pragma GCC diagnostic ignored "-Wstrict-overflow" 37# pragma GCC diagnostic ignored "-Wstrict-overflow"
38# ifndef emacs 38# ifndef emacs
39# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
40# pragma GCC diagnostic ignored "-Wunused-function" 39# pragma GCC diagnostic ignored "-Wunused-function"
41# pragma GCC diagnostic ignored "-Wunused-macros" 40# pragma GCC diagnostic ignored "-Wunused-macros"
42# pragma GCC diagnostic ignored "-Wunused-result" 41# pragma GCC diagnostic ignored "-Wunused-result"
@@ -44,6 +43,10 @@
44# endif 43# endif
45#endif 44#endif
46 45
46#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && ! defined __clang__
47# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
48#endif
49
47#include <config.h> 50#include <config.h>
48 51
49#include <stddef.h> 52#include <stddef.h>
diff --git a/src/undo.c b/src/undo.c
index 63edc8e9b8d..d8711882fbf 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -445,12 +445,6 @@ truncate_undo_list (struct buffer *b)
445 unbind_to (count, Qnil); 445 unbind_to (count, Qnil);
446} 446}
447 447
448static _Noreturn void
449user_error (const char *msg)
450{
451 xsignal1 (Quser_error, build_string (msg));
452}
453
454 448
455void 449void
456syms_of_undo (void) 450syms_of_undo (void)