* 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.
2013-05-18 Paul Eggert <eggert@cs.ucla.edu>
+ 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.
+
* make-dist (files): Add nt/Makefile.in, nt/gnulib.mk.
Otherwise, 'configure; make' fails on non-Windows builds.
i[3456]86-*-* )
case "${canonical}" in
*-darwin* ) opsys=darwin ;;
- *-mingw32 )
+ *-mingw32 )
opsys=mingw32
# MinGW overrides and adds some system headers in nt/inc.
GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
esac
AC_SUBST([WERROR_CFLAGS])
- nw="$nw -Waggregate-return" # anachronistic
- nw="$nw -Wlong-long" # C90 is anachronistic
- nw="$nw -Wc++-compat" # We don't care about C++ compilers
- nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
- nw="$nw -Wtraditional" # Warns on #elif which we use often
- nw="$nw -Wcast-qual" # Too many warnings for now
- nw="$nw -Wconversion" # Too many warnings for now
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
- nw="$nw -Wsign-conversion" # Too many warnings for now
nw="$nw -Woverlength-strings" # Not a problem these days
- nw="$nw -Wtraditional-conversion" # Too many warnings for now
- nw="$nw -Wunreachable-code" # so buggy that it's now silently ignored
- nw="$nw -Wpadded" # Our structs are not padded
- nw="$nw -Wredundant-decls" # we regularly (re)declare functions
nw="$nw -Wlogical-op" # any use of fwrite provokes this
nw="$nw -Wformat-nonliteral" # we do this a lot
nw="$nw -Wvla" # warnings in gettext.h
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
- nw="$nw -Wswitch-enum" # Too many warnings for now
nw="$nw -Wswitch-default" # Too many warnings for now
- nw="$nw -Wfloat-equal" # warns about high-quality code
nw="$nw -Winline" # OK to ignore 'inline'
nw="$nw -Wjump-misses-init" # We sometimes safely jump over init.
nw="$nw -Wstrict-overflow" # OK to optimize assuming that
# The following line should be removable at some point.
nw="$nw -Wsuggest-attribute=pure"
+ # clang is unduly picky about some things.
+ AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #ifndef __clang__
+ #error "not clang"
+ #endif
+ ]])],
+ [emacs_cv_clang=yes],
+ [emacs_cv_clang=no])])
+ if test $emacs_cv_clang = yes; then
+ nw="$nw -Wcast-align"
+ fi
+
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do
# gcc 4.5.0 20090517.
gl_WARN_ADD([-Wno-logical-op])
+ # More things that clang is unduly picky about.
+ if test $emacs_cv_clang = yes; then
+ gl_WARN_ADD([-Wno-format-extra-args])
+ gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
+ gl_WARN_ADD([-Wno-unused-command-line-argument])
+ gl_WARN_ADD([-Wno-unused-value])
+ fi
+
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
EMACS_MANIFEST=
if test "${with_w32}" != no; then
case "${opsys}" in
- cygwin)
+ cygwin)
AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
[AC_MSG_ERROR([`--with-w32' was specified, but windows.h
- cannot be found.])])
+ cannot be found.])])
;;
mingw32)
## Using --with-w32 with MinGW is a no-op, but we allow it.
;;
- *)
+ *)
AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
;;
esac
[[void test(PIMAGE_NT_HEADERS pHeader)
{PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]])],
[emacs_cv_w32api=yes
- HAVE_W32=yes],
+ HAVE_W32=yes],
emacs_cv_w32api=no)
AC_MSG_RESULT($emacs_cv_w32api)
if test "${emacs_cv_w32api}" = "no"; then
USE_GTK_TOOLKIT="GTK3"
if test "x$ac_enable_gtk_deprecation_warnings" = x; then
GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS"
+ GTK_CFLAGS="$GTK_CFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS"
fi
else
check_gtk2=yes
+2013-05-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port --enable-gcc-warnings to clang.
+ * etags.c: Omit unnecessary forward decls.
+ (print_version, print_help): Declare _Noreturn.
+ * pop.c (socket_connection) [HAVE_GETADDRINFO]: Simplify.
+
2013-05-16 Eli Zaretskii <eliz@gnu.org>
* update-game-score.c [WINDOWSNT]: Include "ntlib.h".
static void Yacc_entries (FILE *);
static void just_read_file (FILE *);
-static void print_language_names (void);
-static void print_version (void);
-static void print_help (argument *);
-int main (int, char **);
-
-static compressor *get_compressor_from_suffix (char *, char **);
static language *get_language_from_langname (const char *);
-static language *get_language_from_interpreter (char *);
-static language *get_language_from_filename (char *, bool);
static void readline (linebuffer *, FILE *);
static long readline_internal (linebuffer *, FILE *);
static bool nocase_tail (const char *);
static void free_tree (node *);
static void free_fdesc (fdesc *);
static void pfnote (char *, bool, char *, int, int, long);
-static void make_tag (const char *, int, bool, char *, int, int, long);
static void invalidate_nodes (fdesc *, node **);
static void put_entries (node *);
#ifndef VERSION
# define VERSION "17.38.1.4"
#endif
-static void
+static _Noreturn void
print_version (void)
{
char emacs_copyright[] = COPYRIGHT;
# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE
#endif
-static void
+static _Noreturn void
print_help (argument *argbuffer)
{
bool help_for_lang = FALSE;
}
} while (ret != 0);
- if (ret == 0)
- {
- it = res;
- while (it)
- {
- if (it->ai_addrlen == sizeof (addr))
- {
- struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
- addr.sin_addr = in_a->sin_addr;
- if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
- break;
- }
- it = it->ai_next;
- }
- connect_ok = it != NULL;
- if (connect_ok)
- {
- realhost = alloca (strlen (it->ai_canonname) + 1);
- strcpy (realhost, it->ai_canonname);
- }
- freeaddrinfo (res);
+ for (it = res; it; it = it->ai_next)
+ if (it->ai_addrlen == sizeof addr)
+ {
+ struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
+ addr.sin_addr = in_a->sin_addr;
+ if (! connect (sock, (struct sockaddr *) &addr, sizeof addr))
+ break;
+ }
+ connect_ok = it != NULL;
+ if (connect_ok)
+ {
+ realhost = alloca (strlen (it->ai_canonname) + 1);
+ strcpy (realhost, it->ai_canonname);
}
+ freeaddrinfo (res);
+
#else /* !HAVE_GETADDRINFO */
do
{
+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
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. */
#undef DEFINE
};
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__
# pragma GCC diagnostic pop
#endif
#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);
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;
}
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;
}
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);
}
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;
/* 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"
# 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>
unbind_to (count, Qnil);
}
-static _Noreturn void
-user_error (const char *msg)
-{
- xsignal1 (Quser_error, build_string (msg));
-}
-
\f
void
syms_of_undo (void)