aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2013-07-10 16:23:57 -0700
committerPaul Eggert2013-07-10 16:23:57 -0700
commit29abe551a0d9137718cd21732c9dc383d6493d71 (patch)
tree9730894ac27692871e3c7cba38fcb4df6412d8bc /lib-src
parent3d70c5cfa9aae030c5ab8e8e612319a6645cf659 (diff)
downloademacs-29abe551a0d9137718cd21732c9dc383d6493d71.tar.gz
emacs-29abe551a0d9137718cd21732c9dc383d6493d71.zip
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog12
-rw-r--r--lib-src/ebrowse.c12
-rw-r--r--lib-src/emacsclient.c11
-rw-r--r--lib-src/make-docfile.c2
4 files changed, 31 insertions, 6 deletions
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 @@
12013-07-10 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port to C89.
4 * ebrowse.c (USAGE): Remove macro with too-long string literal ...
5 (usage_message): ... and replace it with this new static constant
6 containing multiple literals. All uses changed.
7 * emacsclient.c (print_help_and_exit):
8 Rewrite to avoid string literals longer than the C89 limits.
9 (start_daemon_and_retry_set_socket):
10 Rewrite to avoid non-constant array initializer.
11 * make-docfile.c (enum global_type): Omit trailing comma.
12
12013-07-02 Paul Eggert <eggert@cs.ucla.edu> 132013-07-02 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 Prefer plain 'static' to 'static inline' (Bug#12541). 15 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)
3481 3481
3482/* Display usage information and exit program. */ 3482/* Display usage information and exit program. */
3483 3483
3484#define USAGE "\ 3484static char const *const usage_message[] =
3485 {
3486 "\
3485Usage: ebrowse [options] {files}\n\ 3487Usage: ebrowse [options] {files}\n\
3486\n\ 3488\n\
3487 -a, --append append output to existing file\n\ 3489 -a, --append append output to existing file\n\
@@ -3489,6 +3491,8 @@ Usage: ebrowse [options] {files}\n\
3489 -I, --search-path=LIST set search path for input files\n\ 3491 -I, --search-path=LIST set search path for input files\n\
3490 -m, --min-regexp-length=N set minimum regexp length to N\n\ 3492 -m, --min-regexp-length=N set minimum regexp length to N\n\
3491 -M, --max-regexp-length=N set maximum regexp length to N\n\ 3493 -M, --max-regexp-length=N set maximum regexp length to N\n\
3494",
3495 "\
3492 -n, --no-nested-classes exclude nested classes\n\ 3496 -n, --no-nested-classes exclude nested classes\n\
3493 -o, --output-file=FILE set output file name to FILE\n\ 3497 -o, --output-file=FILE set output file name to FILE\n\
3494 -p, --position-info print info about position in file\n\ 3498 -p, --position-info print info about position in file\n\
@@ -3498,12 +3502,16 @@ Usage: ebrowse [options] {files}\n\
3498 -x, --no-regexps don't record regular expressions\n\ 3502 -x, --no-regexps don't record regular expressions\n\
3499 --help display this help\n\ 3503 --help display this help\n\
3500 --version display version info\n\ 3504 --version display version info\n\
3505\n\
3501" 3506"
3507 };
3502 3508
3503static _Noreturn void 3509static _Noreturn void
3504usage (int error) 3510usage (int error)
3505{ 3511{
3506 puts (USAGE); 3512 int i;
3513 for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
3514 fputs (usage_message[i], stdout);
3507 exit (error ? EXIT_FAILURE : EXIT_SUCCESS); 3515 exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
3508} 3516}
3509 3517
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)
630 Please try to preserve them; otherwise the output is very hard to read 630 Please try to preserve them; otherwise the output is very hard to read
631 when using emacsclientw. */ 631 when using emacsclientw. */
632 message (FALSE, 632 message (FALSE,
633 "Usage: %s [OPTIONS] FILE...\n\ 633 "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\
634Tell the Emacs server to visit the specified files.\n\ 634Tell the Emacs server to visit the specified files.\n\
635Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ 635Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
636\n\ 636\n\
@@ -640,6 +640,7 @@ The following OPTIONS are accepted:\n\
640-nw, -t, --tty Open a new Emacs frame on the current terminal\n\ 640-nw, -t, --tty Open a new Emacs frame on the current terminal\n\
641-c, --create-frame Create a new frame instead of trying to\n\ 641-c, --create-frame Create a new frame instead of trying to\n\
642 use the current Emacs frame\n\ 642 use the current Emacs frame\n\
643", "\
643-F ALIST, --frame-parameters=ALIST\n\ 644-F ALIST, --frame-parameters=ALIST\n\
644 Set the parameters of a new frame\n\ 645 Set the parameters of a new frame\n\
645-e, --eval Evaluate the FILE arguments as ELisp expressions\n\ 646-e, --eval Evaluate the FILE arguments as ELisp expressions\n\
@@ -647,6 +648,7 @@ The following OPTIONS are accepted:\n\
647-q, --quiet Don't display messages on success\n\ 648-q, --quiet Don't display messages on success\n\
648-d DISPLAY, --display=DISPLAY\n\ 649-d DISPLAY, --display=DISPLAY\n\
649 Visit the file in the given display\n\ 650 Visit the file in the given display\n\
651", "\
650--parent-id=ID Open in parent window ID, via XEmbed\n" 652--parent-id=ID Open in parent window ID, via XEmbed\n"
651#ifndef NO_SOCKETS_IN_FILE_SYSTEM 653#ifndef NO_SOCKETS_IN_FILE_SYSTEM
652"-s SOCKET, --socket-name=SOCKET\n\ 654"-s SOCKET, --socket-name=SOCKET\n\
@@ -661,7 +663,7 @@ The following OPTIONS are accepted:\n\
661 mode and try connecting again\n" 663 mode and try connecting again\n"
662#endif /* not WINDOWSNT */ 664#endif /* not WINDOWSNT */
663"\n\ 665"\n\
664Report bugs with M-x report-emacs-bug.\n", progname); 666Report bugs with M-x report-emacs-bug.\n");
665 exit (EXIT_SUCCESS); 667 exit (EXIT_SUCCESS);
666} 668}
667 669
@@ -1509,7 +1511,10 @@ start_daemon_and_retry_set_socket (void)
1509 { 1511 {
1510 char emacs[] = "emacs"; 1512 char emacs[] = "emacs";
1511 char daemon_option[] = "--daemon"; 1513 char daemon_option[] = "--daemon";
1512 char *d_argv[] = {emacs, daemon_option, 0 }; 1514 char *d_argv[3];
1515 d_argv[0] = emacs;
1516 d_argv[1] = daemon_option;
1517 d_argv[2] = 0;
1513 if (socket_name != NULL) 1518 if (socket_name != NULL)
1514 { 1519 {
1515 /* Pass --daemon=socket_name as argument. */ 1520 /* 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
555 LISP_OBJECT, 555 LISP_OBJECT,
556 EMACS_INTEGER, 556 EMACS_INTEGER,
557 BOOLEAN, 557 BOOLEAN,
558 FUNCTION, 558 FUNCTION
559}; 559};
560 560
561/* A single global. */ 561/* A single global. */