summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 @@
+2013-05-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port --enable-gcc-warnings to clang.
+ * bytecode.c (exec_byte_code):
+ * regex.c:
+ Redo diagnostic pragmas to pacify clang, too.
+ * dbusbind.c (xd_retrieve_arg): Do not use uninitialized variable.
+ * editfns.c (Fencode_time):
+ * fileio.c (file_accessible_directory_p):
+ * font.c (font_unparse_xlfd):
+ Use '&"string"[index]' instead of '"string" + (index)'.
+ * undo.c (user_error): Remove; unused.
+
2013-05-16 Eli Zaretskii <eliz@gnu.org>
* 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,
the table clearer. */
#define LABEL(OP) [OP] = &&insn_ ## OP
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Woverride-init"
+#elif defined __clang__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Winitializer-overrides"
#endif
/* 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,
#undef DEFINE
};
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__
# pragma GCC diagnostic pop
#endif
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)
#endif
{
dbus_uint32_t val;
- unsigned int pval = val;
+ unsigned int pval;
dbus_message_iter_get_basic (iter, &val);
pval = val;
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) */)
EMACS_INT zone_hr = abszone / (60*60);
int zone_min = (abszone/60) % 60;
int zone_sec = abszone % 60;
- sprintf (tzbuf, tzbuf_format, "-" + (XINT (zone) < 0),
+ sprintf (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
zone_hr, zone_min, zone_sec);
tzstring = tzbuf;
}
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)
and it's a safe optimization here. */
char *buf = SAFE_ALLOCA (len + 3);
memcpy (buf, file, len);
- strcpy (buf + len, "/." + (file[len - 1] == '/'));
+ strcpy (buf + len, &"/."[file[len - 1] == '/']);
dir = buf;
}
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)
return -1;
f[j] = p = alloca (alloc);
sprintf (p, "%s%s-*", SDATA (val),
- "*" + (SDATA (val)[SBYTES (val) - 1] == '*'));
+ &"*"[SDATA (val)[SBYTES (val) - 1] == '*']);
}
else
f[j] = SSDATA (val);
@@ -1618,7 +1618,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
}
if (point_size > 0)
{
- int len = snprintf (p, lim - p, "-%d" + (p == name), point_size);
+ int len = snprintf (p, lim - p, &"-%d"[p == name], point_size);
if (! (0 <= len && len < lim - p))
return -1;
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 @@
/* Ignore some GCC warnings for now. This section should go away
once the Emacs and Gnulib regex code is merged. */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) || defined __clang__
# pragma GCC diagnostic ignored "-Wstrict-overflow"
# ifndef emacs
-# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wunused-function"
# pragma GCC diagnostic ignored "-Wunused-macros"
# pragma GCC diagnostic ignored "-Wunused-result"
@@ -44,6 +43,10 @@
# endif
#endif
+#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && ! defined __clang__
+# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+
#include <config.h>
#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)
unbind_to (count, Qnil);
}
-static _Noreturn void
-user_error (const char *msg)
-{
- xsignal1 (Quser_error, build_string (msg));
-}
-
void
syms_of_undo (void)