From 29abe551a0d9137718cd21732c9dc383d6493d71 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 10 Jul 2013 16:23:57 -0700 Subject: Port to C89. * lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ... (usage_message): ... and replace it with this new static constant containing multiple literals. All uses changed. * lib-src/emacsclient.c (print_help_and_exit): Rewrite to avoid string literals longer than the C89 limits. (start_daemon_and_retry_set_socket): Rewrite to avoid non-constant array initializer. * lib-src/make-docfile.c (enum global_type): Omit trailing comma. * src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__. (B__dummy__): New dummy symbol, to pacify C89. * src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since they can't grok varargs macros. * src/dispnew.c (add_window_display_history) (add_frame_display_history): * src/print.c (print_object): * src/xdisp.c (debug_method_add): Use %p printf format only for void pointers. * src/emacs.c (usage_message): New constant, replacing ... (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89. (main): Adjust to usage reorg. * src/fns.c (syms_of_fns): * src/profiler.c (syms_of_profiler): Don't use non-constant struct initializers. * src/gnutls.h (gnutls_initstage_t): * src/lisp.h (enum Lisp_Fwd_Type): * src/lread.c (lisp_file_lexically_bound_p): * src/xsettings.c (anonymous enum): Remove trailing comma. * src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism. * src/lisp.h (ENUM_BF): Use unsigned if pedantic. (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99. (DEFUN): Use it. * src/regex.c (const_re_char): New type, to pacify strict C89. All uses of 'const re_char' replaced to use it. * src/regex.h (_Restrict_): Rename from __restrict, to avoid clash with glibc when strict C89. This change is imported from gnulib. All uses changed. (_Restrict_arr_): Rename from __restrict_arr, similarly. * src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]: Omit GNU_LINUX implementation, since it requires long long. * src/xterm.c (x_draw_underwave): Do not assume the traditional order of struct's members. (x_term_init): Rewrite to avoid the need for non-constant structure initializers. --- lib-src/ChangeLog | 12 ++++++++++++ lib-src/ebrowse.c | 12 ++++++++++-- lib-src/emacsclient.c | 11 ++++++++--- lib-src/make-docfile.c | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 875e6b167d5..f41c23df5d2 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,15 @@ +2013-07-10 Paul Eggert + + Port to C89. + * ebrowse.c (USAGE): Remove macro with too-long string literal ... + (usage_message): ... and replace it with this new static constant + containing multiple literals. All uses changed. + * emacsclient.c (print_help_and_exit): + Rewrite to avoid string literals longer than the C89 limits. + (start_daemon_and_retry_set_socket): + Rewrite to avoid non-constant array initializer. + * make-docfile.c (enum global_type): Omit trailing comma. + 2013-07-02 Paul Eggert Prefer plain 'static' to 'static inline' (Bug#12541). diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 407f769afc8..216865c3800 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -3481,7 +3481,9 @@ open_file (char *file) /* Display usage information and exit program. */ -#define USAGE "\ +static char const *const usage_message[] = + { + "\ Usage: ebrowse [options] {files}\n\ \n\ -a, --append append output to existing file\n\ @@ -3489,6 +3491,8 @@ Usage: ebrowse [options] {files}\n\ -I, --search-path=LIST set search path for input files\n\ -m, --min-regexp-length=N set minimum regexp length to N\n\ -M, --max-regexp-length=N set maximum regexp length to N\n\ +", + "\ -n, --no-nested-classes exclude nested classes\n\ -o, --output-file=FILE set output file name to FILE\n\ -p, --position-info print info about position in file\n\ @@ -3498,12 +3502,16 @@ Usage: ebrowse [options] {files}\n\ -x, --no-regexps don't record regular expressions\n\ --help display this help\n\ --version display version info\n\ +\n\ " + }; static _Noreturn void usage (int error) { - puts (USAGE); + int i; + for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++) + fputs (usage_message[i], stdout); exit (error ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 898e8d69b07..74ccfa26259 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -630,7 +630,7 @@ print_help_and_exit (void) Please try to preserve them; otherwise the output is very hard to read when using emacsclientw. */ message (FALSE, - "Usage: %s [OPTIONS] FILE...\n\ + "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\ Tell the Emacs server to visit the specified files.\n\ Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ \n\ @@ -640,6 +640,7 @@ The following OPTIONS are accepted:\n\ -nw, -t, --tty Open a new Emacs frame on the current terminal\n\ -c, --create-frame Create a new frame instead of trying to\n\ use the current Emacs frame\n\ +", "\ -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ @@ -647,6 +648,7 @@ The following OPTIONS are accepted:\n\ -q, --quiet Don't display messages on success\n\ -d DISPLAY, --display=DISPLAY\n\ Visit the file in the given display\n\ +", "\ --parent-id=ID Open in parent window ID, via XEmbed\n" #ifndef NO_SOCKETS_IN_FILE_SYSTEM "-s SOCKET, --socket-name=SOCKET\n\ @@ -661,7 +663,7 @@ The following OPTIONS are accepted:\n\ mode and try connecting again\n" #endif /* not WINDOWSNT */ "\n\ -Report bugs with M-x report-emacs-bug.\n", progname); +Report bugs with M-x report-emacs-bug.\n"); exit (EXIT_SUCCESS); } @@ -1509,7 +1511,10 @@ start_daemon_and_retry_set_socket (void) { char emacs[] = "emacs"; char daemon_option[] = "--daemon"; - char *d_argv[] = {emacs, daemon_option, 0 }; + char *d_argv[3]; + d_argv[0] = emacs; + d_argv[1] = daemon_option; + d_argv[2] = 0; if (socket_name != NULL) { /* Pass --daemon=socket_name as argument. */ diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 9bc91bc4f77..73d1a0eb31d 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -555,7 +555,7 @@ enum global_type LISP_OBJECT, EMACS_INTEGER, BOOLEAN, - FUNCTION, + FUNCTION }; /* A single global. */ -- cgit v1.2.1