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.
This commit is contained in:
Paul Eggert 2013-07-10 16:23:57 -07:00
parent 3d70c5cfa9
commit 29abe551a0
21 changed files with 277 additions and 154 deletions

View file

@ -1,3 +1,15 @@
2013-07-10 Paul Eggert <eggert@cs.ucla.edu>
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 <eggert@cs.ucla.edu>
Prefer plain 'static' to 'static inline' (Bug#12541).

View file

@ -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);
}

View file

@ -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. */

View file

@ -555,7 +555,7 @@ enum global_type
LISP_OBJECT,
EMACS_INTEGER,
BOOLEAN,
FUNCTION,
FUNCTION
};
/* A single global. */

View file

@ -1,5 +1,43 @@
2013-07-10 Paul Eggert <eggert@cs.ucla.edu>
Port to C89.
* bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* dispnew.c (add_window_display_history)
(add_frame_display_history):
* print.c (print_object):
* xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* fns.c (syms_of_fns):
* profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* gnutls.h (gnutls_initstage_t):
* lisp.h (enum Lisp_Fwd_Type):
* lread.c (lisp_file_lexically_bound_p):
* xsettings.c (anonymous enum):
Remove trailing comma.
* xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* 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.
* regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* 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.
* sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* 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.
Syntax cleanup, mostly replacing macros with functions.
` This removes the need for the syntax_temp hack.
* search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR.

View file

@ -59,7 +59,8 @@ by Hallvard:
indirect threaded, using GCC's computed goto extension. This code,
as currently implemented, is incompatible with BYTE_CODE_SAFE and
BYTE_CODE_METER. */
#if defined (__GNUC__) && !defined (BYTE_CODE_SAFE) && !defined (BYTE_CODE_METER)
#if (defined __GNUC__ && !defined __STRICT_ANSI__ \
&& !defined BYTE_CODE_SAFE && !defined BYTE_CODE_METER)
#define BYTE_CODE_THREADED
#endif
@ -285,8 +286,10 @@ enum byte_code_op
#ifdef BYTE_CODE_SAFE
Bscan_buffer = 0153, /* No longer generated as of v18. */
Bset_mark = 0163 /* this loser is no longer generated as of v18 */
Bset_mark = 0163, /* this loser is no longer generated as of v18 */
#endif
B__dummy__ = 0 /* Pacify C89. */
};
/* Whether to maintain a `top' and `bottom' field in the stack frame. */

View file

@ -142,7 +142,10 @@ static bool xd_in_read_queued_messages = 0;
} while (0)
#else /* !DBUS_DEBUG */
#define XD_DEBUG_MESSAGE(...) \
# if __STDC_VERSION__ < 199901
# define XD_DEBUG_MESSAGE (void) /* Pre-C99 compilers cannot debug. */
# else
# define XD_DEBUG_MESSAGE(...) \
do { \
if (!NILP (Vdbus_debug)) \
{ \
@ -151,7 +154,8 @@ static bool xd_in_read_queued_messages = 0;
message ("%s: %s", __func__, s); \
} \
} while (0)
#define XD_DEBUG_VALID_LISP_OBJECT_P(object)
# endif
# define XD_DEBUG_VALID_LISP_OBJECT_P(object)
#endif
/* Check whether TYPE is a basic DBusType. */

View file

@ -213,6 +213,7 @@ static void
add_window_display_history (struct window *w, const char *msg, bool paused_p)
{
char *buf;
void *ptr = w;
if (history_idx >= REDISPLAY_HISTORY_SIZE)
history_idx = 0;
@ -222,7 +223,7 @@ add_window_display_history (struct window *w, const char *msg, bool paused_p)
snprintf (buf, sizeof redisplay_history[0].trace,
"%"pMu": window %p (`%s')%s\n%s",
history_tick++,
w,
ptr,
((BUFFERP (w->contents)
&& STRINGP (BVAR (XBUFFER (w->contents), name)))
? SSDATA (BVAR (XBUFFER (w->contents), name))
@ -240,6 +241,7 @@ static void
add_frame_display_history (struct frame *f, bool paused_p)
{
char *buf;
void *ptr = f;
if (history_idx >= REDISPLAY_HISTORY_SIZE)
history_idx = 0;
@ -248,7 +250,7 @@ add_frame_display_history (struct frame *f, bool paused_p)
sprintf (buf, "%"pMu": update frame %p%s",
history_tick++,
f, paused_p ? " ***paused***" : "");
ptr, paused_p ? " ***paused***" : "");
}

View file

@ -201,10 +201,10 @@ int initial_argc;
static void sort_args (int argc, char **argv);
static void syms_of_emacs (void);
/* MSVC needs each string be shorter than 2048 bytes, so the usage
/* C89 needs each string be at most 509 characters, so the usage
strings below are split to not overflow this limit. */
#define USAGE1 "\
Usage: %s [OPTION-OR-FILENAME]...\n\
static char const *const usage_message[] =
{ "\
\n\
Run Emacs, the extensible, customizable, self-documenting real-time\n\
display editor. The recommended way to start Emacs for normal editing\n\
@ -215,11 +215,15 @@ read the main documentation for these command-line arguments.\n\
\n\
Initialization options:\n\
\n\
",
"\
--batch do not do interactive display; implies -q\n\
--chdir DIR change to directory DIR\n\
--daemon start a server in the background\n\
--debug-init enable Emacs Lisp debugger for init file\n\
--display, -d DISPLAY use X server DISPLAY\n\
",
"\
--no-desktop do not load a saved desktop\n\
--no-init-file, -q load neither ~/.emacs nor default.el\n\
--no-shared-memory, -nl do not use shared memory\n\
@ -227,14 +231,16 @@ Initialization options:\n\
--no-site-lisp, -nsl do not add site-lisp directories to load-path\n\
--no-splash do not display a splash screen on startup\n\
--no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\
",
"\
--quick, -Q equivalent to:\n\
-q --no-site-file --no-site-lisp --no-splash\n\
--script FILE run FILE as an Emacs Lisp script\n\
--terminal, -t DEVICE use DEVICE for terminal I/O\n\
--user, -u USER load ~USER/.emacs instead of your own\n\
\n%s"
#define USAGE2 "\
\n\
",
"\
Action options:\n\
\n\
FILE visit FILE using find-file\n\
@ -243,6 +249,8 @@ FILE visit FILE using find-file\n\
--directory, -L DIR add DIR to variable load-path\n\
--eval EXPR evaluate Emacs Lisp expression EXPR\n\
--execute EXPR evaluate Emacs Lisp expression EXPR\n\
",
"\
--file FILE visit FILE using find-file\n\
--find-file FILE visit FILE using find-file\n\
--funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\
@ -250,9 +258,9 @@ FILE visit FILE using find-file\n\
--kill exit without asking for confirmation\n\
--load, -l FILE load Emacs Lisp FILE using the load function\n\
--visit FILE visit FILE using find-file\n\
\n"
#define USAGE3 "\
\n\
",
"\
Display options:\n\
\n\
--background-color, -bg COLOR window background color\n\
@ -260,6 +268,8 @@ Display options:\n\
used for debugging Emacs\n\
--border-color, -bd COLOR main border color\n\
--border-width, -bw WIDTH width of main border\n\
",
"\
--color, --color=MODE override color mode for character terminals;\n\
MODE defaults to `auto', and\n\
can also be `never', `always',\n\
@ -267,17 +277,23 @@ Display options:\n\
--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\
--font, -fn FONT default font; must be fixed-width\n\
--foreground-color, -fg COLOR window foreground color\n\
",
"\
--fullheight, -fh make the first frame high as the screen\n\
--fullscreen, -fs make the first frame fullscreen\n\
--fullwidth, -fw make the first frame wide as the screen\n\
--maximized, -mm make the first frame maximized\n\
--geometry, -g GEOMETRY window geometry\n\
",
"\
--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\
--iconic start Emacs in iconified state\n\
--internal-border, -ib WIDTH width between text and main border\n\
--line-spacing, -lsp PIXELS additional space to put between lines\n\
--mouse-color, -ms COLOR mouse cursor color in Emacs window\n\
--name NAME title for initial Emacs frame\n\
",
"\
--no-blinking-cursor, -nbc disable blinking cursor\n\
--reverse-video, -r, -rv switch foreground and background\n\
--title, -T TITLE title for initial Emacs frame\n\
@ -286,9 +302,9 @@ Display options:\n\
--parent-id XID set parent window\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n"
#define USAGE4 "\
\n\
",
"\
You can generally also specify long option names with a single -; for\n\
example, -batch as well as --batch. You can use any unambiguous\n\
abbreviation for a --option.\n\
@ -298,6 +314,7 @@ Emacs' operation. See the main documentation.\n\
\n\
Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\
section of the Emacs manual or the file BUGS.\n"
};
/* True if handling a fatal error already. */
@ -934,9 +951,10 @@ main (int argc, char **argv)
/* Handle the --help option, which gives a usage message. */
if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
{
printf (USAGE1, argv[0], USAGE2);
printf (USAGE3);
printf (USAGE4);
int i;
printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]);
for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
fputs (usage_message[i], stdout);
exit (0);
}

View file

@ -5011,13 +5011,21 @@ this variable. */);
defsubr (&Ssecure_hash);
defsubr (&Slocale_info);
{
struct hash_table_test
eq = { Qeq, Qnil, Qnil, NULL, hashfn_eq },
eql = { Qeql, Qnil, Qnil, cmpfn_eql, hashfn_eql },
equal = { Qequal, Qnil, Qnil, cmpfn_equal, hashfn_equal };
hashtest_eq = eq;
hashtest_eql = eql;
hashtest_equal = equal;
}
hashtest_eq.name = Qeq;
hashtest_eq.user_hash_function = Qnil;
hashtest_eq.user_cmp_function = Qnil;
hashtest_eq.cmpfn = 0;
hashtest_eq.hashfn = hashfn_eq;
hashtest_eql.name = Qeql;
hashtest_eql.user_hash_function = Qnil;
hashtest_eql.user_cmp_function = Qnil;
hashtest_eql.cmpfn = cmpfn_eql;
hashtest_eql.hashfn = hashfn_eql;
hashtest_equal.name = Qequal;
hashtest_equal.user_hash_function = Qnil;
hashtest_equal.user_cmp_function = Qnil;
hashtest_equal.cmpfn = cmpfn_equal;
hashtest_equal.hashfn = hashfn_equal;
}

View file

@ -42,7 +42,7 @@ typedef enum
GNUTLS_STAGE_TRANSPORT_POINTERS_SET,
GNUTLS_STAGE_HANDSHAKE_TRIED,
GNUTLS_STAGE_READY,
GNUTLS_STAGE_READY
} gnutls_initstage_t;
#define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1

View file

@ -363,9 +363,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
/* Idea stolen from GDB. MSVC doesn't support enums in bitfields,
and xlc complains vociferously about them. */
#if defined _MSC_VER || defined __IBMC__
/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
MSVC doesn't support them, and xlc complains vociferously about them. */
#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__
#define ENUM_BF(TYPE) unsigned int
#else
#define ENUM_BF(TYPE) enum TYPE
@ -398,7 +398,7 @@ enum Lisp_Type
/* Cons. XCONS (object) points to a struct Lisp_Cons. */
Lisp_Cons = 6,
Lisp_Float = 7,
Lisp_Float = 7
};
/* This is the set of data types that share a common structure.
@ -428,7 +428,7 @@ enum Lisp_Fwd_Type
Lisp_Fwd_Bool, /* Fwd to a C boolean var. */
Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */
Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */
Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */
Lisp_Fwd_Kboard_Obj /* Fwd to a Lisp_Object field of kboards. */
};
/* If you want to define a new Lisp data type, here are some
@ -2540,11 +2540,16 @@ CHECK_NUMBER_CDR (Lisp_Object x)
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#else /* not _MSC_VER */
# if __STDC_VERSION__ < 199901
# define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname
# else
# define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname
# endif
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
{ { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
{ .a ## maxargs = fnname }, \
{ DEFUN_FUNCTION_INIT (fnname, maxargs) }, \
minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
#endif

View file

@ -823,7 +823,7 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
{
bool rv = 0;
enum {
NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX,
NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX
} beg_end_state = NOMINAL;
bool in_file_vars = 0;

View file

@ -1765,9 +1765,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
}
else if (WINDOWP (obj))
{
int len;
strout ("#<window ", -1, -1, printcharfun);
len = sprintf (buf, "%p", XWINDOW (obj));
void *ptr = XWINDOW (obj);
int len = sprintf (buf, "#<window %p", ptr);
strout (buf, len, len, printcharfun);
if (BUFFERP (XWINDOW (obj)->contents))
{
@ -1798,6 +1797,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
ptrdiff_t real_size, size;
int len;
#if 0
void *ptr = h;
strout ("#<hash-table", -1, -1, printcharfun);
if (SYMBOLP (h->test))
{
@ -1810,9 +1810,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next));
strout (buf, len, len, printcharfun);
}
len = sprintf (buf, " %p", h);
len = sprintf (buf, " %p>", ptr);
strout (buf, len, len, printcharfun);
PRINTCHAR ('>');
#endif
/* Implement a readable output, e.g.:
#s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
@ -1892,6 +1891,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
else if (FRAMEP (obj))
{
int len;
void *ptr = XFRAME (obj);
Lisp_Object frame_name = XFRAME (obj)->name;
strout ((FRAME_LIVE_P (XFRAME (obj))
@ -1907,9 +1907,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
frame_name = build_string ("*INVALID*FRAME*NAME*");
}
print_string (frame_name, printcharfun);
len = sprintf (buf, " %p", XFRAME (obj));
len = sprintf (buf, " %p>", ptr);
strout (buf, len, len, printcharfun);
PRINTCHAR ('>');
}
else if (FONTP (obj))
{

View file

@ -568,12 +568,12 @@ to make room for new entries. */);
profiler_log_size = 10000;
DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal");
{
struct hash_table_test test
= { Qprofiler_backtrace_equal, Qnil, Qnil,
cmpfn_profiler, hashfn_profiler };
hashtest_profiler = test;
}
hashtest_profiler.name = Qprofiler_backtrace_equal;
hashtest_profiler.user_hash_function = Qnil;
hashtest_profiler.user_cmp_function = Qnil;
hashtest_profiler.cmpfn = cmpfn_profiler;
hashtest_profiler.hashfn = hashfn_profiler;
defsubr (&Sfunction_equal);

View file

@ -531,8 +531,10 @@ init_syntax_once (void)
/* Type of source-pattern and string chars. */
#ifdef _MSC_VER
typedef unsigned char re_char;
typedef const re_char const_re_char;
#else
typedef const unsigned char re_char;
typedef re_char const_re_char;
#endif
typedef char boolean;
@ -2015,7 +2017,7 @@ struct range_table_work_area
/* Map a string to the char class it names (if any). */
re_wctype_t
re_wctype (const re_char *str)
re_wctype (const_re_char *str)
{
const char *string = (const char *) str;
if (STREQ (string, "alnum")) return RECC_ALNUM;
@ -2409,7 +2411,8 @@ do { \
} while (0)
static reg_errcode_t
regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)
regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
struct re_pattern_buffer *bufp)
{
/* We fetch characters from PATTERN here. */
register re_wchar_t c, c1;
@ -3765,7 +3768,7 @@ insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned cha
least one character before the ^. */
static boolean
at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax)
at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax)
{
re_char *prev = p - 2;
boolean odd_backslashes;
@ -3806,7 +3809,7 @@ at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax)
at least one character after the $, i.e., `P < PEND'. */
static boolean
at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax)
at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax)
{
re_char *next = p;
boolean next_backslash = *next == '\\';
@ -3850,7 +3853,8 @@ group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
Return -1 if fastmap was not updated accurately. */
static int
analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte)
analyse_first (const_re_char *p, const_re_char *pend, char *fastmap,
const int multibyte)
{
int j, k;
boolean not;
@ -4594,7 +4598,7 @@ static int bcmp_translate (re_char *s1, re_char *s2,
/* If the operation is a match against one or more chars,
return a pointer to the next operation, else return NULL. */
static re_char *
skip_one_char (const re_char *p)
skip_one_char (const_re_char *p)
{
switch (*p++)
{
@ -4636,7 +4640,7 @@ skip_one_char (const re_char *p)
/* Jump over non-matching operations. */
static re_char *
skip_noops (const re_char *p, const re_char *pend)
skip_noops (const_re_char *p, const_re_char *pend)
{
int mcnt;
while (p < pend)
@ -4663,7 +4667,8 @@ skip_noops (const re_char *p, const re_char *pend)
/* Non-zero if "p1 matches something" implies "p2 fails". */
static int
mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2)
mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1,
const_re_char *p2)
{
re_opcode_t op2;
const boolean multibyte = RE_MULTIBYTE_P (bufp);
@ -4922,8 +4927,8 @@ WEAK_ALIAS (__re_match_2, re_match_2)
/* This is a separate function so that we can force an alloca cleanup
afterwards. */
static regoff_t
re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1,
size_t size1, const re_char *string2, size_t size2,
re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
size_t size1, const_re_char *string2, size_t size2,
ssize_t pos, struct re_registers *regs, ssize_t stop)
{
/* General temporaries. */
@ -6265,7 +6270,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1,
bytes; nonzero otherwise. */
static int
bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len,
bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len,
RE_TRANSLATE_TYPE translate, const int target_multibyte)
{
register re_char *p1 = s1, *p2 = s2;
@ -6434,7 +6439,7 @@ re_exec (const char *s)
the return codes and their meanings.) */
reg_errcode_t
regcomp (regex_t *__restrict preg, const char *__restrict pattern,
regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern,
int cflags)
{
reg_errcode_t ret;
@ -6515,8 +6520,8 @@ WEAK_ALIAS (__regcomp, regcomp)
We return 0 if we find a match and REG_NOMATCH if not. */
reg_errcode_t
regexec (const regex_t *__restrict preg, const char *__restrict string,
size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string,
size_t nmatch, regmatch_t pmatch[_Restrict_arr_], int eflags)
{
regoff_t ret;
struct re_registers regs;

View file

@ -528,31 +528,41 @@ extern int re_exec (const char *);
#endif
/* GCC 2.95 and later have "__restrict"; C99 compilers have
"restrict", and "configure" may have defined "restrict". */
#ifndef __restrict
# if ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# if defined restrict || 199901L <= __STDC_VERSION__
# define __restrict restrict
# else
# define __restrict
# endif
"restrict", and "configure" may have defined "restrict".
Other compilers use __restrict, __restrict__, and _Restrict, and
'configure' might #define 'restrict' to those words, so pick a
different name. */
#ifndef _Restrict_
# if 199901L <= __STDC_VERSION__
# define _Restrict_ restrict
# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
# define _Restrict_ __restrict
# else
# define _Restrict_
# endif
#endif
/* For now conditionally define __restrict_arr to expand to nothing.
Ideally we would have a test for the compiler which allows defining
it to restrict. */
#ifndef __restrict_arr
# define __restrict_arr
/* gcc 3.1 and up support the [restrict] syntax. Don't trust
sys/cdefs.h's definition of __restrict_arr, though, as it
mishandles gcc -ansi -pedantic. */
#ifndef _Restrict_arr_
# if ((199901L <= __STDC_VERSION__ \
|| ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
&& !defined __STRICT_ANSI__)) \
&& !defined __GNUG__)
# define _Restrict_arr_ _Restrict_
# else
# define _Restrict_arr_
# endif
#endif
/* POSIX compatibility. */
extern reg_errcode_t regcomp (regex_t *__restrict __preg,
const char *__restrict __pattern,
extern reg_errcode_t regcomp (regex_t *_Restrict_ __preg,
const char *_Restrict_ __pattern,
int __cflags);
extern reg_errcode_t regexec (const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
extern reg_errcode_t regexec (const regex_t *_Restrict_ __preg,
const char *_Restrict_ __string, size_t __nmatch,
regmatch_t __pmatch[_Restrict_arr_],
int __eflags);
extern size_t regerror (int __errcode, const regex_t * __preg,

View file

@ -2676,7 +2676,7 @@ list_system_processes (void)
#endif /* !defined (WINDOWSNT) */
#ifdef GNU_LINUX
#if defined GNU_LINUX && defined HAVE_LONG_LONG_INT
static EMACS_TIME
time_from_jiffies (unsigned long long tval, long hz)
{

View file

@ -12589,6 +12589,7 @@ static void debug_method_add (struct window *, char const *, ...)
static void
debug_method_add (struct window *w, char const *fmt, ...)
{
void *ptr = w;
char *method = w->desired_matrix->method;
int len = strlen (method);
int size = sizeof w->desired_matrix->method;
@ -12607,7 +12608,7 @@ debug_method_add (struct window *w, char const *fmt, ...)
if (trace_redisplay_p)
fprintf (stderr, "%p (%s): %s\n",
w,
ptr,
((BUFFERP (w->contents)
&& STRINGP (BVAR (XBUFFER (w->contents), name)))
? SSDATA (BVAR (XBUFFER (w->contents), name))

View file

@ -170,7 +170,7 @@ enum {
SEEN_HINTSTYLE = 0x10,
SEEN_DPI = 0x20,
SEEN_FONT = 0x40,
SEEN_TB_STYLE = 0x80,
SEEN_TB_STYLE = 0x80
};
struct xsettings
{
@ -687,7 +687,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
static char const format[] =
"Antialias: %d, Hinting: %d, RGBA: %d, LCDFilter: %d, "
"Hintstyle: %d, DPI: %lf";
"Hintstyle: %d, DPI: %f";
enum
{
d_formats = 5,
@ -696,7 +696,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
max_f_integer_digits = DBL_MAX_10_EXP + 1,
f_precision = 6,
lf_growth = (sizeof "-." + max_f_integer_digits + f_precision
- sizeof "%lf")
- sizeof "%f")
};
char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth];

View file

@ -2647,7 +2647,10 @@ x_draw_underwave (struct glyph_string *s)
/* Find and set clipping rectangle */
wave_clip = (XRectangle){ x0, y0, width, wave_height };
wave_clip.x = x0;
wave_clip.y = y0;
wave_clip.width = width;
wave_clip.height = wave_height;
get_glyph_string_clip_rect (s, &string_clip);
if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip))
@ -10191,71 +10194,73 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
}
{
const struct
static const struct
{
const char *name;
Atom *atom;
int offset;
} atom_refs[] = {
{ "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols },
{ "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus },
{ "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself },
{ "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window },
{ "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state },
{ "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied },
{ "WM_MOVED", &dpyinfo->Xatom_wm_window_moved },
{ "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader },
{ "Editres", &dpyinfo->Xatom_editres },
{ "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD },
{ "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP },
{ "TEXT", &dpyinfo->Xatom_TEXT },
{ "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT },
{ "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING },
{ "DELETE", &dpyinfo->Xatom_DELETE },
{ "MULTIPLE", &dpyinfo->Xatom_MULTIPLE },
{ "INCR", &dpyinfo->Xatom_INCR },
{ "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
{ "TARGETS", &dpyinfo->Xatom_TARGETS },
{ "NULL", &dpyinfo->Xatom_NULL },
{ "ATOM", &dpyinfo->Xatom_ATOM },
{ "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
{ "CLIPBOARD_MANAGER", &dpyinfo->Xatom_CLIPBOARD_MANAGER },
{ "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
#define ATOM_REFS_INIT(string, member) \
{ string, offsetof (struct x_display_info, member) },
ATOM_REFS_INIT ("WM_PROTOCOLS", Xatom_wm_protocols)
ATOM_REFS_INIT ("WM_TAKE_FOCUS", Xatom_wm_take_focus)
ATOM_REFS_INIT ("WM_SAVE_YOURSELF", Xatom_wm_save_yourself)
ATOM_REFS_INIT ("WM_DELETE_WINDOW", Xatom_wm_delete_window)
ATOM_REFS_INIT ("WM_CHANGE_STATE", Xatom_wm_change_state)
ATOM_REFS_INIT ("WM_CONFIGURE_DENIED", Xatom_wm_configure_denied)
ATOM_REFS_INIT ("WM_MOVED", Xatom_wm_window_moved)
ATOM_REFS_INIT ("WM_CLIENT_LEADER", Xatom_wm_client_leader)
ATOM_REFS_INIT ("Editres", Xatom_editres)
ATOM_REFS_INIT ("CLIPBOARD", Xatom_CLIPBOARD)
ATOM_REFS_INIT ("TIMESTAMP", Xatom_TIMESTAMP)
ATOM_REFS_INIT ("TEXT", Xatom_TEXT)
ATOM_REFS_INIT ("COMPOUND_TEXT", Xatom_COMPOUND_TEXT)
ATOM_REFS_INIT ("UTF8_STRING", Xatom_UTF8_STRING)
ATOM_REFS_INIT ("DELETE", Xatom_DELETE)
ATOM_REFS_INIT ("MULTIPLE", Xatom_MULTIPLE)
ATOM_REFS_INIT ("INCR", Xatom_INCR)
ATOM_REFS_INIT ("_EMACS_TMP_", Xatom_EMACS_TMP)
ATOM_REFS_INIT ("TARGETS", Xatom_TARGETS)
ATOM_REFS_INIT ("NULL", Xatom_NULL)
ATOM_REFS_INIT ("ATOM", Xatom_ATOM)
ATOM_REFS_INIT ("ATOM_PAIR", Xatom_ATOM_PAIR)
ATOM_REFS_INIT ("CLIPBOARD_MANAGER", Xatom_CLIPBOARD_MANAGER)
ATOM_REFS_INIT ("_XEMBED_INFO", Xatom_XEMBED_INFO)
/* For properties of font. */
{ "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
{ "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH },
{ "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET },
{ "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE },
{ "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT },
ATOM_REFS_INIT ("PIXEL_SIZE", Xatom_PIXEL_SIZE)
ATOM_REFS_INIT ("AVERAGE_WIDTH", Xatom_AVERAGE_WIDTH)
ATOM_REFS_INIT ("_MULE_BASELINE_OFFSET", Xatom_MULE_BASELINE_OFFSET)
ATOM_REFS_INIT ("_MULE_RELATIVE_COMPOSE", Xatom_MULE_RELATIVE_COMPOSE)
ATOM_REFS_INIT ("_MULE_DEFAULT_ASCENT", Xatom_MULE_DEFAULT_ASCENT)
/* Ghostscript support. */
{ "DONE", &dpyinfo->Xatom_DONE },
{ "PAGE", &dpyinfo->Xatom_PAGE },
{ "SCROLLBAR", &dpyinfo->Xatom_Scrollbar },
{ "_XEMBED", &dpyinfo->Xatom_XEMBED },
ATOM_REFS_INIT ("DONE", Xatom_DONE)
ATOM_REFS_INIT ("PAGE", Xatom_PAGE)
ATOM_REFS_INIT ("SCROLLBAR", Xatom_Scrollbar)
ATOM_REFS_INIT ("_XEMBED", Xatom_XEMBED)
/* EWMH */
{ "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state },
{ "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen },
{ "_NET_WM_STATE_MAXIMIZED_HORZ",
&dpyinfo->Xatom_net_wm_state_maximized_horz },
{ "_NET_WM_STATE_MAXIMIZED_VERT",
&dpyinfo->Xatom_net_wm_state_maximized_vert },
{ "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky },
{ "_NET_WM_STATE_HIDDEN", &dpyinfo->Xatom_net_wm_state_hidden },
{ "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type },
{ "_NET_WM_WINDOW_TYPE_TOOLTIP",
&dpyinfo->Xatom_net_window_type_tooltip },
{ "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name },
{ "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name },
{ "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported },
{ "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check },
{ "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity },
{ "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window },
{ "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents },
{ "_NET_CURRENT_DESKTOP", &dpyinfo->Xatom_net_current_desktop },
{ "_NET_WORKAREA", &dpyinfo->Xatom_net_workarea },
ATOM_REFS_INIT ("_NET_WM_STATE", Xatom_net_wm_state)
ATOM_REFS_INIT ("_NET_WM_STATE_FULLSCREEN", Xatom_net_wm_state_fullscreen)
ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_HORZ",
Xatom_net_wm_state_maximized_horz)
ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_VERT",
Xatom_net_wm_state_maximized_vert)
ATOM_REFS_INIT ("_NET_WM_STATE_STICKY", Xatom_net_wm_state_sticky)
ATOM_REFS_INIT ("_NET_WM_STATE_HIDDEN", Xatom_net_wm_state_hidden)
ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE", Xatom_net_window_type)
ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE_TOOLTIP",
Xatom_net_window_type_tooltip)
ATOM_REFS_INIT ("_NET_WM_ICON_NAME", Xatom_net_wm_icon_name)
ATOM_REFS_INIT ("_NET_WM_NAME", Xatom_net_wm_name)
ATOM_REFS_INIT ("_NET_SUPPORTED", Xatom_net_supported)
ATOM_REFS_INIT ("_NET_SUPPORTING_WM_CHECK", Xatom_net_supporting_wm_check)
ATOM_REFS_INIT ("_NET_WM_WINDOW_OPACITY", Xatom_net_wm_window_opacity)
ATOM_REFS_INIT ("_NET_ACTIVE_WINDOW", Xatom_net_active_window)
ATOM_REFS_INIT ("_NET_FRAME_EXTENTS", Xatom_net_frame_extents)
ATOM_REFS_INIT ("_NET_CURRENT_DESKTOP", Xatom_net_current_desktop)
ATOM_REFS_INIT ("_NET_WORKAREA", Xatom_net_workarea)
/* Session management */
{ "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID },
{ "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop },
{ "MANAGER", &dpyinfo->Xatom_xsettings_mgr },
ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID)
ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop)
ATOM_REFS_INIT ("MANAGER", Xatom_xsettings_mgr)
};
int i;
@ -10280,7 +10285,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
False, atoms_return);
for (i = 0; i < atom_count; i++)
*atom_refs[i].atom = atoms_return[i];
*(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i];
/* Manual copy of last atom */
dpyinfo->Xatom_xsettings_sel = atoms_return[i];