aboutsummaryrefslogtreecommitdiffstats
path: root/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 /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 'src')
-rw-r--r--src/ChangeLog38
-rw-r--r--src/bytecode.c7
-rw-r--r--src/dbusbind.c8
-rw-r--r--src/dispnew.c6
-rw-r--r--src/emacs.c48
-rw-r--r--src/fns.c26
-rw-r--r--src/gnutls.h2
-rw-r--r--src/lisp.h17
-rw-r--r--src/lread.c2
-rw-r--r--src/print.c13
-rw-r--r--src/profiler.c12
-rw-r--r--src/regex.c33
-rw-r--r--src/regex.h46
-rw-r--r--src/sysdep.c2
-rw-r--r--src/xdisp.c3
-rw-r--r--src/xsettings.c6
-rw-r--r--src/xterm.c125
17 files changed, 246 insertions, 148 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4d2c0409860..1231c1adc14 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,43 @@
12013-07-10 Paul Eggert <eggert@cs.ucla.edu> 12013-07-10 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Port to C89.
4 * bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
5 (B__dummy__): New dummy symbol, to pacify C89.
6 * dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
7 they can't grok varargs macros.
8 * dispnew.c (add_window_display_history)
9 (add_frame_display_history):
10 * print.c (print_object):
11 * xdisp.c (debug_method_add):
12 Use %p printf format only for void pointers.
13 * emacs.c (usage_message): New constant, replacing ...
14 (USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
15 (main): Adjust to usage reorg.
16 * fns.c (syms_of_fns):
17 * profiler.c (syms_of_profiler):
18 Don't use non-constant struct initializers.
19 * gnutls.h (gnutls_initstage_t):
20 * lisp.h (enum Lisp_Fwd_Type):
21 * lread.c (lisp_file_lexically_bound_p):
22 * xsettings.c (anonymous enum):
23 Remove trailing comma.
24 * xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
25 * lisp.h (ENUM_BF): Use unsigned if pedantic.
26 (DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
27 (DEFUN): Use it.
28 * regex.c (const_re_char): New type, to pacify strict C89.
29 All uses of 'const re_char' replaced to use it.
30 * regex.h (_Restrict_): Rename from __restrict, to avoid clash
31 with glibc when strict C89. This change is imported from gnulib.
32 All uses changed.
33 (_Restrict_arr_): Rename from __restrict_arr, similarly.
34 * sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
35 Omit GNU_LINUX implementation, since it requires long long.
36 * xterm.c (x_draw_underwave):
37 Do not assume the traditional order of struct's members.
38 (x_term_init): Rewrite to avoid the need for non-constant structure
39 initializers.
40
3 Syntax cleanup, mostly replacing macros with functions. 41 Syntax cleanup, mostly replacing macros with functions.
4` This removes the need for the syntax_temp hack. 42` This removes the need for the syntax_temp hack.
5 * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR. 43 * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR.
diff --git a/src/bytecode.c b/src/bytecode.c
index d95c53bf055..c79027597f8 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -59,7 +59,8 @@ by Hallvard:
59 indirect threaded, using GCC's computed goto extension. This code, 59 indirect threaded, using GCC's computed goto extension. This code,
60 as currently implemented, is incompatible with BYTE_CODE_SAFE and 60 as currently implemented, is incompatible with BYTE_CODE_SAFE and
61 BYTE_CODE_METER. */ 61 BYTE_CODE_METER. */
62#if defined (__GNUC__) && !defined (BYTE_CODE_SAFE) && !defined (BYTE_CODE_METER) 62#if (defined __GNUC__ && !defined __STRICT_ANSI__ \
63 && !defined BYTE_CODE_SAFE && !defined BYTE_CODE_METER)
63#define BYTE_CODE_THREADED 64#define BYTE_CODE_THREADED
64#endif 65#endif
65 66
@@ -285,8 +286,10 @@ enum byte_code_op
285 286
286#ifdef BYTE_CODE_SAFE 287#ifdef BYTE_CODE_SAFE
287 Bscan_buffer = 0153, /* No longer generated as of v18. */ 288 Bscan_buffer = 0153, /* No longer generated as of v18. */
288 Bset_mark = 0163 /* this loser is no longer generated as of v18 */ 289 Bset_mark = 0163, /* this loser is no longer generated as of v18 */
289#endif 290#endif
291
292 B__dummy__ = 0 /* Pacify C89. */
290}; 293};
291 294
292/* Whether to maintain a `top' and `bottom' field in the stack frame. */ 295/* Whether to maintain a `top' and `bottom' field in the stack frame. */
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 3ec3c28431b..523544d56ca 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -142,7 +142,10 @@ static bool xd_in_read_queued_messages = 0;
142 } while (0) 142 } while (0)
143 143
144#else /* !DBUS_DEBUG */ 144#else /* !DBUS_DEBUG */
145#define XD_DEBUG_MESSAGE(...) \ 145# if __STDC_VERSION__ < 199901
146# define XD_DEBUG_MESSAGE (void) /* Pre-C99 compilers cannot debug. */
147# else
148# define XD_DEBUG_MESSAGE(...) \
146 do { \ 149 do { \
147 if (!NILP (Vdbus_debug)) \ 150 if (!NILP (Vdbus_debug)) \
148 { \ 151 { \
@@ -151,7 +154,8 @@ static bool xd_in_read_queued_messages = 0;
151 message ("%s: %s", __func__, s); \ 154 message ("%s: %s", __func__, s); \
152 } \ 155 } \
153 } while (0) 156 } while (0)
154#define XD_DEBUG_VALID_LISP_OBJECT_P(object) 157# endif
158# define XD_DEBUG_VALID_LISP_OBJECT_P(object)
155#endif 159#endif
156 160
157/* Check whether TYPE is a basic DBusType. */ 161/* Check whether TYPE is a basic DBusType. */
diff --git a/src/dispnew.c b/src/dispnew.c
index 31b8a1310ea..1eb097f05ab 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -213,6 +213,7 @@ static void
213add_window_display_history (struct window *w, const char *msg, bool paused_p) 213add_window_display_history (struct window *w, const char *msg, bool paused_p)
214{ 214{
215 char *buf; 215 char *buf;
216 void *ptr = w;
216 217
217 if (history_idx >= REDISPLAY_HISTORY_SIZE) 218 if (history_idx >= REDISPLAY_HISTORY_SIZE)
218 history_idx = 0; 219 history_idx = 0;
@@ -222,7 +223,7 @@ add_window_display_history (struct window *w, const char *msg, bool paused_p)
222 snprintf (buf, sizeof redisplay_history[0].trace, 223 snprintf (buf, sizeof redisplay_history[0].trace,
223 "%"pMu": window %p (`%s')%s\n%s", 224 "%"pMu": window %p (`%s')%s\n%s",
224 history_tick++, 225 history_tick++,
225 w, 226 ptr,
226 ((BUFFERP (w->contents) 227 ((BUFFERP (w->contents)
227 && STRINGP (BVAR (XBUFFER (w->contents), name))) 228 && STRINGP (BVAR (XBUFFER (w->contents), name)))
228 ? SSDATA (BVAR (XBUFFER (w->contents), name)) 229 ? SSDATA (BVAR (XBUFFER (w->contents), name))
@@ -240,6 +241,7 @@ static void
240add_frame_display_history (struct frame *f, bool paused_p) 241add_frame_display_history (struct frame *f, bool paused_p)
241{ 242{
242 char *buf; 243 char *buf;
244 void *ptr = f;
243 245
244 if (history_idx >= REDISPLAY_HISTORY_SIZE) 246 if (history_idx >= REDISPLAY_HISTORY_SIZE)
245 history_idx = 0; 247 history_idx = 0;
@@ -248,7 +250,7 @@ add_frame_display_history (struct frame *f, bool paused_p)
248 250
249 sprintf (buf, "%"pMu": update frame %p%s", 251 sprintf (buf, "%"pMu": update frame %p%s",
250 history_tick++, 252 history_tick++,
251 f, paused_p ? " ***paused***" : ""); 253 ptr, paused_p ? " ***paused***" : "");
252} 254}
253 255
254 256
diff --git a/src/emacs.c b/src/emacs.c
index 7c0ddf97a01..5babf3af029 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -201,10 +201,10 @@ int initial_argc;
201static void sort_args (int argc, char **argv); 201static void sort_args (int argc, char **argv);
202static void syms_of_emacs (void); 202static void syms_of_emacs (void);
203 203
204/* MSVC needs each string be shorter than 2048 bytes, so the usage 204/* C89 needs each string be at most 509 characters, so the usage
205 strings below are split to not overflow this limit. */ 205 strings below are split to not overflow this limit. */
206#define USAGE1 "\ 206static char const *const usage_message[] =
207Usage: %s [OPTION-OR-FILENAME]...\n\ 207 { "\
208\n\ 208\n\
209Run Emacs, the extensible, customizable, self-documenting real-time\n\ 209Run Emacs, the extensible, customizable, self-documenting real-time\n\
210display editor. The recommended way to start Emacs for normal editing\n\ 210display 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\
215\n\ 215\n\
216Initialization options:\n\ 216Initialization options:\n\
217\n\ 217\n\
218",
219 "\
218--batch do not do interactive display; implies -q\n\ 220--batch do not do interactive display; implies -q\n\
219--chdir DIR change to directory DIR\n\ 221--chdir DIR change to directory DIR\n\
220--daemon start a server in the background\n\ 222--daemon start a server in the background\n\
221--debug-init enable Emacs Lisp debugger for init file\n\ 223--debug-init enable Emacs Lisp debugger for init file\n\
222--display, -d DISPLAY use X server DISPLAY\n\ 224--display, -d DISPLAY use X server DISPLAY\n\
225",
226 "\
223--no-desktop do not load a saved desktop\n\ 227--no-desktop do not load a saved desktop\n\
224--no-init-file, -q load neither ~/.emacs nor default.el\n\ 228--no-init-file, -q load neither ~/.emacs nor default.el\n\
225--no-shared-memory, -nl do not use shared memory\n\ 229--no-shared-memory, -nl do not use shared memory\n\
@@ -227,14 +231,16 @@ Initialization options:\n\
227--no-site-lisp, -nsl do not add site-lisp directories to load-path\n\ 231--no-site-lisp, -nsl do not add site-lisp directories to load-path\n\
228--no-splash do not display a splash screen on startup\n\ 232--no-splash do not display a splash screen on startup\n\
229--no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\ 233--no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\
234",
235 "\
230--quick, -Q equivalent to:\n\ 236--quick, -Q equivalent to:\n\
231 -q --no-site-file --no-site-lisp --no-splash\n\ 237 -q --no-site-file --no-site-lisp --no-splash\n\
232--script FILE run FILE as an Emacs Lisp script\n\ 238--script FILE run FILE as an Emacs Lisp script\n\
233--terminal, -t DEVICE use DEVICE for terminal I/O\n\ 239--terminal, -t DEVICE use DEVICE for terminal I/O\n\
234--user, -u USER load ~USER/.emacs instead of your own\n\ 240--user, -u USER load ~USER/.emacs instead of your own\n\
235\n%s" 241\n\
236 242",
237#define USAGE2 "\ 243 "\
238Action options:\n\ 244Action options:\n\
239\n\ 245\n\
240FILE visit FILE using find-file\n\ 246FILE visit FILE using find-file\n\
@@ -243,6 +249,8 @@ FILE visit FILE using find-file\n\
243--directory, -L DIR add DIR to variable load-path\n\ 249--directory, -L DIR add DIR to variable load-path\n\
244--eval EXPR evaluate Emacs Lisp expression EXPR\n\ 250--eval EXPR evaluate Emacs Lisp expression EXPR\n\
245--execute EXPR evaluate Emacs Lisp expression EXPR\n\ 251--execute EXPR evaluate Emacs Lisp expression EXPR\n\
252",
253 "\
246--file FILE visit FILE using find-file\n\ 254--file FILE visit FILE using find-file\n\
247--find-file FILE visit FILE using find-file\n\ 255--find-file FILE visit FILE using find-file\n\
248--funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\ 256--funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\
@@ -250,9 +258,9 @@ FILE visit FILE using find-file\n\
250--kill exit without asking for confirmation\n\ 258--kill exit without asking for confirmation\n\
251--load, -l FILE load Emacs Lisp FILE using the load function\n\ 259--load, -l FILE load Emacs Lisp FILE using the load function\n\
252--visit FILE visit FILE using find-file\n\ 260--visit FILE visit FILE using find-file\n\
253\n" 261\n\
254 262",
255#define USAGE3 "\ 263 "\
256Display options:\n\ 264Display options:\n\
257\n\ 265\n\
258--background-color, -bg COLOR window background color\n\ 266--background-color, -bg COLOR window background color\n\
@@ -260,6 +268,8 @@ Display options:\n\
260 used for debugging Emacs\n\ 268 used for debugging Emacs\n\
261--border-color, -bd COLOR main border color\n\ 269--border-color, -bd COLOR main border color\n\
262--border-width, -bw WIDTH width of main border\n\ 270--border-width, -bw WIDTH width of main border\n\
271",
272 "\
263--color, --color=MODE override color mode for character terminals;\n\ 273--color, --color=MODE override color mode for character terminals;\n\
264 MODE defaults to `auto', and\n\ 274 MODE defaults to `auto', and\n\
265 can also be `never', `always',\n\ 275 can also be `never', `always',\n\
@@ -267,17 +277,23 @@ Display options:\n\
267--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ 277--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\
268--font, -fn FONT default font; must be fixed-width\n\ 278--font, -fn FONT default font; must be fixed-width\n\
269--foreground-color, -fg COLOR window foreground color\n\ 279--foreground-color, -fg COLOR window foreground color\n\
280",
281 "\
270--fullheight, -fh make the first frame high as the screen\n\ 282--fullheight, -fh make the first frame high as the screen\n\
271--fullscreen, -fs make the first frame fullscreen\n\ 283--fullscreen, -fs make the first frame fullscreen\n\
272--fullwidth, -fw make the first frame wide as the screen\n\ 284--fullwidth, -fw make the first frame wide as the screen\n\
273--maximized, -mm make the first frame maximized\n\ 285--maximized, -mm make the first frame maximized\n\
274--geometry, -g GEOMETRY window geometry\n\ 286--geometry, -g GEOMETRY window geometry\n\
287",
288 "\
275--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\ 289--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\
276--iconic start Emacs in iconified state\n\ 290--iconic start Emacs in iconified state\n\
277--internal-border, -ib WIDTH width between text and main border\n\ 291--internal-border, -ib WIDTH width between text and main border\n\
278--line-spacing, -lsp PIXELS additional space to put between lines\n\ 292--line-spacing, -lsp PIXELS additional space to put between lines\n\
279--mouse-color, -ms COLOR mouse cursor color in Emacs window\n\ 293--mouse-color, -ms COLOR mouse cursor color in Emacs window\n\
280--name NAME title for initial Emacs frame\n\ 294--name NAME title for initial Emacs frame\n\
295",
296 "\
281--no-blinking-cursor, -nbc disable blinking cursor\n\ 297--no-blinking-cursor, -nbc disable blinking cursor\n\
282--reverse-video, -r, -rv switch foreground and background\n\ 298--reverse-video, -r, -rv switch foreground and background\n\
283--title, -T TITLE title for initial Emacs frame\n\ 299--title, -T TITLE title for initial Emacs frame\n\
@@ -286,9 +302,9 @@ Display options:\n\
286--parent-id XID set parent window\n\ 302--parent-id XID set parent window\n\
287--help display this help and exit\n\ 303--help display this help and exit\n\
288--version output version information and exit\n\ 304--version output version information and exit\n\
289\n" 305\n\
290 306",
291#define USAGE4 "\ 307 "\
292You can generally also specify long option names with a single -; for\n\ 308You can generally also specify long option names with a single -; for\n\
293example, -batch as well as --batch. You can use any unambiguous\n\ 309example, -batch as well as --batch. You can use any unambiguous\n\
294abbreviation for a --option.\n\ 310abbreviation for a --option.\n\
@@ -298,6 +314,7 @@ Emacs' operation. See the main documentation.\n\
298\n\ 314\n\
299Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\ 315Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\
300section of the Emacs manual or the file BUGS.\n" 316section of the Emacs manual or the file BUGS.\n"
317 };
301 318
302 319
303/* True if handling a fatal error already. */ 320/* True if handling a fatal error already. */
@@ -934,9 +951,10 @@ main (int argc, char **argv)
934 /* Handle the --help option, which gives a usage message. */ 951 /* Handle the --help option, which gives a usage message. */
935 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args)) 952 if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
936 { 953 {
937 printf (USAGE1, argv[0], USAGE2); 954 int i;
938 printf (USAGE3); 955 printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]);
939 printf (USAGE4); 956 for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
957 fputs (usage_message[i], stdout);
940 exit (0); 958 exit (0);
941 } 959 }
942 960
diff --git a/src/fns.c b/src/fns.c
index 7a8ddc04540..49bd8470f7f 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5011,13 +5011,21 @@ this variable. */);
5011 defsubr (&Ssecure_hash); 5011 defsubr (&Ssecure_hash);
5012 defsubr (&Slocale_info); 5012 defsubr (&Slocale_info);
5013 5013
5014 { 5014 hashtest_eq.name = Qeq;
5015 struct hash_table_test 5015 hashtest_eq.user_hash_function = Qnil;
5016 eq = { Qeq, Qnil, Qnil, NULL, hashfn_eq }, 5016 hashtest_eq.user_cmp_function = Qnil;
5017 eql = { Qeql, Qnil, Qnil, cmpfn_eql, hashfn_eql }, 5017 hashtest_eq.cmpfn = 0;
5018 equal = { Qequal, Qnil, Qnil, cmpfn_equal, hashfn_equal }; 5018 hashtest_eq.hashfn = hashfn_eq;
5019 hashtest_eq = eq; 5019
5020 hashtest_eql = eql; 5020 hashtest_eql.name = Qeql;
5021 hashtest_equal = equal; 5021 hashtest_eql.user_hash_function = Qnil;
5022 } 5022 hashtest_eql.user_cmp_function = Qnil;
5023 hashtest_eql.cmpfn = cmpfn_eql;
5024 hashtest_eql.hashfn = hashfn_eql;
5025
5026 hashtest_equal.name = Qequal;
5027 hashtest_equal.user_hash_function = Qnil;
5028 hashtest_equal.user_cmp_function = Qnil;
5029 hashtest_equal.cmpfn = cmpfn_equal;
5030 hashtest_equal.hashfn = hashfn_equal;
5023} 5031}
diff --git a/src/gnutls.h b/src/gnutls.h
index f1a337e7b3e..86dcab77b62 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -42,7 +42,7 @@ typedef enum
42 GNUTLS_STAGE_TRANSPORT_POINTERS_SET, 42 GNUTLS_STAGE_TRANSPORT_POINTERS_SET,
43 GNUTLS_STAGE_HANDSHAKE_TRIED, 43 GNUTLS_STAGE_HANDSHAKE_TRIED,
44 44
45 GNUTLS_STAGE_READY, 45 GNUTLS_STAGE_READY
46} gnutls_initstage_t; 46} gnutls_initstage_t;
47 47
48#define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1 48#define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1
diff --git a/src/lisp.h b/src/lisp.h
index 33e9309de34..4af256f54b6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -363,9 +363,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
363#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) 363#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
364#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 364#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
365 365
366/* Idea stolen from GDB. MSVC doesn't support enums in bitfields, 366/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
367 and xlc complains vociferously about them. */ 367 MSVC doesn't support them, and xlc complains vociferously about them. */
368#if defined _MSC_VER || defined __IBMC__ 368#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__
369#define ENUM_BF(TYPE) unsigned int 369#define ENUM_BF(TYPE) unsigned int
370#else 370#else
371#define ENUM_BF(TYPE) enum TYPE 371#define ENUM_BF(TYPE) enum TYPE
@@ -398,7 +398,7 @@ enum Lisp_Type
398 /* Cons. XCONS (object) points to a struct Lisp_Cons. */ 398 /* Cons. XCONS (object) points to a struct Lisp_Cons. */
399 Lisp_Cons = 6, 399 Lisp_Cons = 6,
400 400
401 Lisp_Float = 7, 401 Lisp_Float = 7
402 }; 402 };
403 403
404/* This is the set of data types that share a common structure. 404/* This is the set of data types that share a common structure.
@@ -428,7 +428,7 @@ enum Lisp_Fwd_Type
428 Lisp_Fwd_Bool, /* Fwd to a C boolean var. */ 428 Lisp_Fwd_Bool, /* Fwd to a C boolean var. */
429 Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */ 429 Lisp_Fwd_Obj, /* Fwd to a C Lisp_Object variable. */
430 Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */ 430 Lisp_Fwd_Buffer_Obj, /* Fwd to a Lisp_Object field of buffers. */
431 Lisp_Fwd_Kboard_Obj, /* Fwd to a Lisp_Object field of kboards. */ 431 Lisp_Fwd_Kboard_Obj /* Fwd to a Lisp_Object field of kboards. */
432 }; 432 };
433 433
434/* If you want to define a new Lisp data type, here are some 434/* If you want to define a new Lisp data type, here are some
@@ -2540,11 +2540,16 @@ CHECK_NUMBER_CDR (Lisp_Object x)
2540 minargs, maxargs, lname, intspec, 0}; \ 2540 minargs, maxargs, lname, intspec, 0}; \
2541 Lisp_Object fnname 2541 Lisp_Object fnname
2542#else /* not _MSC_VER */ 2542#else /* not _MSC_VER */
2543# if __STDC_VERSION__ < 199901
2544# define DEFUN_FUNCTION_INIT(fnname, maxargs) (Lisp_Object (*) (void)) fnname
2545# else
2546# define DEFUN_FUNCTION_INIT(fnname, maxargs) .a ## maxargs = fnname
2547# endif
2543#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 2548#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2544 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 2549 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
2545 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ 2550 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
2546 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ 2551 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
2547 { .a ## maxargs = fnname }, \ 2552 { DEFUN_FUNCTION_INIT (fnname, maxargs) }, \
2548 minargs, maxargs, lname, intspec, 0}; \ 2553 minargs, maxargs, lname, intspec, 0}; \
2549 Lisp_Object fnname 2554 Lisp_Object fnname
2550#endif 2555#endif
diff --git a/src/lread.c b/src/lread.c
index 83d2e8d954a..ae945d113dd 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -823,7 +823,7 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
823 { 823 {
824 bool rv = 0; 824 bool rv = 0;
825 enum { 825 enum {
826 NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX, 826 NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX
827 } beg_end_state = NOMINAL; 827 } beg_end_state = NOMINAL;
828 bool in_file_vars = 0; 828 bool in_file_vars = 0;
829 829
diff --git a/src/print.c b/src/print.c
index a16f3b32f46..8ea76d98854 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1765,9 +1765,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1765 } 1765 }
1766 else if (WINDOWP (obj)) 1766 else if (WINDOWP (obj))
1767 { 1767 {
1768 int len; 1768 void *ptr = XWINDOW (obj);
1769 strout ("#<window ", -1, -1, printcharfun); 1769 int len = sprintf (buf, "#<window %p", ptr);
1770 len = sprintf (buf, "%p", XWINDOW (obj));
1771 strout (buf, len, len, printcharfun); 1770 strout (buf, len, len, printcharfun);
1772 if (BUFFERP (XWINDOW (obj)->contents)) 1771 if (BUFFERP (XWINDOW (obj)->contents))
1773 { 1772 {
@@ -1798,6 +1797,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1798 ptrdiff_t real_size, size; 1797 ptrdiff_t real_size, size;
1799 int len; 1798 int len;
1800#if 0 1799#if 0
1800 void *ptr = h;
1801 strout ("#<hash-table", -1, -1, printcharfun); 1801 strout ("#<hash-table", -1, -1, printcharfun);
1802 if (SYMBOLP (h->test)) 1802 if (SYMBOLP (h->test))
1803 { 1803 {
@@ -1810,9 +1810,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1810 len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next)); 1810 len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next));
1811 strout (buf, len, len, printcharfun); 1811 strout (buf, len, len, printcharfun);
1812 } 1812 }
1813 len = sprintf (buf, " %p", h); 1813 len = sprintf (buf, " %p>", ptr);
1814 strout (buf, len, len, printcharfun); 1814 strout (buf, len, len, printcharfun);
1815 PRINTCHAR ('>');
1816#endif 1815#endif
1817 /* Implement a readable output, e.g.: 1816 /* Implement a readable output, e.g.:
1818 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ 1817 #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)
1892 else if (FRAMEP (obj)) 1891 else if (FRAMEP (obj))
1893 { 1892 {
1894 int len; 1893 int len;
1894 void *ptr = XFRAME (obj);
1895 Lisp_Object frame_name = XFRAME (obj)->name; 1895 Lisp_Object frame_name = XFRAME (obj)->name;
1896 1896
1897 strout ((FRAME_LIVE_P (XFRAME (obj)) 1897 strout ((FRAME_LIVE_P (XFRAME (obj))
@@ -1907,9 +1907,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1907 frame_name = build_string ("*INVALID*FRAME*NAME*"); 1907 frame_name = build_string ("*INVALID*FRAME*NAME*");
1908 } 1908 }
1909 print_string (frame_name, printcharfun); 1909 print_string (frame_name, printcharfun);
1910 len = sprintf (buf, " %p", XFRAME (obj)); 1910 len = sprintf (buf, " %p>", ptr);
1911 strout (buf, len, len, printcharfun); 1911 strout (buf, len, len, printcharfun);
1912 PRINTCHAR ('>');
1913 } 1912 }
1914 else if (FONTP (obj)) 1913 else if (FONTP (obj))
1915 { 1914 {
diff --git a/src/profiler.c b/src/profiler.c
index aba81344c68..c86fb47d21d 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -568,12 +568,12 @@ to make room for new entries. */);
568 profiler_log_size = 10000; 568 profiler_log_size = 10000;
569 569
570 DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal"); 570 DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal");
571 { 571
572 struct hash_table_test test 572 hashtest_profiler.name = Qprofiler_backtrace_equal;
573 = { Qprofiler_backtrace_equal, Qnil, Qnil, 573 hashtest_profiler.user_hash_function = Qnil;
574 cmpfn_profiler, hashfn_profiler }; 574 hashtest_profiler.user_cmp_function = Qnil;
575 hashtest_profiler = test; 575 hashtest_profiler.cmpfn = cmpfn_profiler;
576 } 576 hashtest_profiler.hashfn = hashfn_profiler;
577 577
578 defsubr (&Sfunction_equal); 578 defsubr (&Sfunction_equal);
579 579
diff --git a/src/regex.c b/src/regex.c
index 79fb28ba12a..39adb080efd 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -531,8 +531,10 @@ init_syntax_once (void)
531/* Type of source-pattern and string chars. */ 531/* Type of source-pattern and string chars. */
532#ifdef _MSC_VER 532#ifdef _MSC_VER
533typedef unsigned char re_char; 533typedef unsigned char re_char;
534typedef const re_char const_re_char;
534#else 535#else
535typedef const unsigned char re_char; 536typedef const unsigned char re_char;
537typedef re_char const_re_char;
536#endif 538#endif
537 539
538typedef char boolean; 540typedef char boolean;
@@ -2015,7 +2017,7 @@ struct range_table_work_area
2015 2017
2016/* Map a string to the char class it names (if any). */ 2018/* Map a string to the char class it names (if any). */
2017re_wctype_t 2019re_wctype_t
2018re_wctype (const re_char *str) 2020re_wctype (const_re_char *str)
2019{ 2021{
2020 const char *string = (const char *) str; 2022 const char *string = (const char *) str;
2021 if (STREQ (string, "alnum")) return RECC_ALNUM; 2023 if (STREQ (string, "alnum")) return RECC_ALNUM;
@@ -2409,7 +2411,8 @@ do { \
2409 } while (0) 2411 } while (0)
2410 2412
2411static reg_errcode_t 2413static reg_errcode_t
2412regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp) 2414regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
2415 struct re_pattern_buffer *bufp)
2413{ 2416{
2414 /* We fetch characters from PATTERN here. */ 2417 /* We fetch characters from PATTERN here. */
2415 register re_wchar_t c, c1; 2418 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
3765 least one character before the ^. */ 3768 least one character before the ^. */
3766 3769
3767static boolean 3770static boolean
3768at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax) 3771at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t syntax)
3769{ 3772{
3770 re_char *prev = p - 2; 3773 re_char *prev = p - 2;
3771 boolean odd_backslashes; 3774 boolean odd_backslashes;
@@ -3806,7 +3809,7 @@ at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax)
3806 at least one character after the $, i.e., `P < PEND'. */ 3809 at least one character after the $, i.e., `P < PEND'. */
3807 3810
3808static boolean 3811static boolean
3809at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax) 3812at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t syntax)
3810{ 3813{
3811 re_char *next = p; 3814 re_char *next = p;
3812 boolean next_backslash = *next == '\\'; 3815 boolean next_backslash = *next == '\\';
@@ -3850,7 +3853,8 @@ group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
3850 Return -1 if fastmap was not updated accurately. */ 3853 Return -1 if fastmap was not updated accurately. */
3851 3854
3852static int 3855static int
3853analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int multibyte) 3856analyse_first (const_re_char *p, const_re_char *pend, char *fastmap,
3857 const int multibyte)
3854{ 3858{
3855 int j, k; 3859 int j, k;
3856 boolean not; 3860 boolean not;
@@ -4594,7 +4598,7 @@ static int bcmp_translate (re_char *s1, re_char *s2,
4594/* If the operation is a match against one or more chars, 4598/* If the operation is a match against one or more chars,
4595 return a pointer to the next operation, else return NULL. */ 4599 return a pointer to the next operation, else return NULL. */
4596static re_char * 4600static re_char *
4597skip_one_char (const re_char *p) 4601skip_one_char (const_re_char *p)
4598{ 4602{
4599 switch (*p++) 4603 switch (*p++)
4600 { 4604 {
@@ -4636,7 +4640,7 @@ skip_one_char (const re_char *p)
4636 4640
4637/* Jump over non-matching operations. */ 4641/* Jump over non-matching operations. */
4638static re_char * 4642static re_char *
4639skip_noops (const re_char *p, const re_char *pend) 4643skip_noops (const_re_char *p, const_re_char *pend)
4640{ 4644{
4641 int mcnt; 4645 int mcnt;
4642 while (p < pend) 4646 while (p < pend)
@@ -4663,7 +4667,8 @@ skip_noops (const re_char *p, const re_char *pend)
4663 4667
4664/* Non-zero if "p1 matches something" implies "p2 fails". */ 4668/* Non-zero if "p1 matches something" implies "p2 fails". */
4665static int 4669static int
4666mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const re_char *p2) 4670mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1,
4671 const_re_char *p2)
4667{ 4672{
4668 re_opcode_t op2; 4673 re_opcode_t op2;
4669 const boolean multibyte = RE_MULTIBYTE_P (bufp); 4674 const boolean multibyte = RE_MULTIBYTE_P (bufp);
@@ -4922,8 +4927,8 @@ WEAK_ALIAS (__re_match_2, re_match_2)
4922/* This is a separate function so that we can force an alloca cleanup 4927/* This is a separate function so that we can force an alloca cleanup
4923 afterwards. */ 4928 afterwards. */
4924static regoff_t 4929static regoff_t
4925re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, 4930re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
4926 size_t size1, const re_char *string2, size_t size2, 4931 size_t size1, const_re_char *string2, size_t size2,
4927 ssize_t pos, struct re_registers *regs, ssize_t stop) 4932 ssize_t pos, struct re_registers *regs, ssize_t stop)
4928{ 4933{
4929 /* General temporaries. */ 4934 /* General temporaries. */
@@ -6265,7 +6270,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1,
6265 bytes; nonzero otherwise. */ 6270 bytes; nonzero otherwise. */
6266 6271
6267static int 6272static int
6268bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len, 6273bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t len,
6269 RE_TRANSLATE_TYPE translate, const int target_multibyte) 6274 RE_TRANSLATE_TYPE translate, const int target_multibyte)
6270{ 6275{
6271 register re_char *p1 = s1, *p2 = s2; 6276 register re_char *p1 = s1, *p2 = s2;
@@ -6434,7 +6439,7 @@ re_exec (const char *s)
6434 the return codes and their meanings.) */ 6439 the return codes and their meanings.) */
6435 6440
6436reg_errcode_t 6441reg_errcode_t
6437regcomp (regex_t *__restrict preg, const char *__restrict pattern, 6442regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern,
6438 int cflags) 6443 int cflags)
6439{ 6444{
6440 reg_errcode_t ret; 6445 reg_errcode_t ret;
@@ -6515,8 +6520,8 @@ WEAK_ALIAS (__regcomp, regcomp)
6515 We return 0 if we find a match and REG_NOMATCH if not. */ 6520 We return 0 if we find a match and REG_NOMATCH if not. */
6516 6521
6517reg_errcode_t 6522reg_errcode_t
6518regexec (const regex_t *__restrict preg, const char *__restrict string, 6523regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string,
6519 size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) 6524 size_t nmatch, regmatch_t pmatch[_Restrict_arr_], int eflags)
6520{ 6525{
6521 regoff_t ret; 6526 regoff_t ret;
6522 struct re_registers regs; 6527 struct re_registers regs;
diff --git a/src/regex.h b/src/regex.h
index 8fe7ba16adc..bb737df5239 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -528,31 +528,41 @@ extern int re_exec (const char *);
528#endif 528#endif
529 529
530/* GCC 2.95 and later have "__restrict"; C99 compilers have 530/* GCC 2.95 and later have "__restrict"; C99 compilers have
531 "restrict", and "configure" may have defined "restrict". */ 531 "restrict", and "configure" may have defined "restrict".
532#ifndef __restrict 532 Other compilers use __restrict, __restrict__, and _Restrict, and
533# if ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) 533 'configure' might #define 'restrict' to those words, so pick a
534# if defined restrict || 199901L <= __STDC_VERSION__ 534 different name. */
535# define __restrict restrict 535#ifndef _Restrict_
536# else 536# if 199901L <= __STDC_VERSION__
537# define __restrict 537# define _Restrict_ restrict
538# endif 538# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
539# define _Restrict_ __restrict
540# else
541# define _Restrict_
539# endif 542# endif
540#endif 543#endif
541/* For now conditionally define __restrict_arr to expand to nothing. 544/* gcc 3.1 and up support the [restrict] syntax. Don't trust
542 Ideally we would have a test for the compiler which allows defining 545 sys/cdefs.h's definition of __restrict_arr, though, as it
543 it to restrict. */ 546 mishandles gcc -ansi -pedantic. */
544#ifndef __restrict_arr 547#ifndef _Restrict_arr_
545# define __restrict_arr 548# if ((199901L <= __STDC_VERSION__ \
549 || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
550 && !defined __STRICT_ANSI__)) \
551 && !defined __GNUG__)
552# define _Restrict_arr_ _Restrict_
553# else
554# define _Restrict_arr_
555# endif
546#endif 556#endif
547 557
548/* POSIX compatibility. */ 558/* POSIX compatibility. */
549extern reg_errcode_t regcomp (regex_t *__restrict __preg, 559extern reg_errcode_t regcomp (regex_t *_Restrict_ __preg,
550 const char *__restrict __pattern, 560 const char *_Restrict_ __pattern,
551 int __cflags); 561 int __cflags);
552 562
553extern reg_errcode_t regexec (const regex_t *__restrict __preg, 563extern reg_errcode_t regexec (const regex_t *_Restrict_ __preg,
554 const char *__restrict __string, size_t __nmatch, 564 const char *_Restrict_ __string, size_t __nmatch,
555 regmatch_t __pmatch[__restrict_arr], 565 regmatch_t __pmatch[_Restrict_arr_],
556 int __eflags); 566 int __eflags);
557 567
558extern size_t regerror (int __errcode, const regex_t * __preg, 568extern size_t regerror (int __errcode, const regex_t * __preg,
diff --git a/src/sysdep.c b/src/sysdep.c
index 6346b0bbfcd..2f86b1f8bd5 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2676,7 +2676,7 @@ list_system_processes (void)
2676 2676
2677#endif /* !defined (WINDOWSNT) */ 2677#endif /* !defined (WINDOWSNT) */
2678 2678
2679#ifdef GNU_LINUX 2679#if defined GNU_LINUX && defined HAVE_LONG_LONG_INT
2680static EMACS_TIME 2680static EMACS_TIME
2681time_from_jiffies (unsigned long long tval, long hz) 2681time_from_jiffies (unsigned long long tval, long hz)
2682{ 2682{
diff --git a/src/xdisp.c b/src/xdisp.c
index 5869ce5fdfa..12b294e6800 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12589,6 +12589,7 @@ static void debug_method_add (struct window *, char const *, ...)
12589static void 12589static void
12590debug_method_add (struct window *w, char const *fmt, ...) 12590debug_method_add (struct window *w, char const *fmt, ...)
12591{ 12591{
12592 void *ptr = w;
12592 char *method = w->desired_matrix->method; 12593 char *method = w->desired_matrix->method;
12593 int len = strlen (method); 12594 int len = strlen (method);
12594 int size = sizeof w->desired_matrix->method; 12595 int size = sizeof w->desired_matrix->method;
@@ -12607,7 +12608,7 @@ debug_method_add (struct window *w, char const *fmt, ...)
12607 12608
12608 if (trace_redisplay_p) 12609 if (trace_redisplay_p)
12609 fprintf (stderr, "%p (%s): %s\n", 12610 fprintf (stderr, "%p (%s): %s\n",
12610 w, 12611 ptr,
12611 ((BUFFERP (w->contents) 12612 ((BUFFERP (w->contents)
12612 && STRINGP (BVAR (XBUFFER (w->contents), name))) 12613 && STRINGP (BVAR (XBUFFER (w->contents), name)))
12613 ? SSDATA (BVAR (XBUFFER (w->contents), name)) 12614 ? SSDATA (BVAR (XBUFFER (w->contents), name))
diff --git a/src/xsettings.c b/src/xsettings.c
index f48c49dbafe..45f8435d9f4 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -170,7 +170,7 @@ enum {
170 SEEN_HINTSTYLE = 0x10, 170 SEEN_HINTSTYLE = 0x10,
171 SEEN_DPI = 0x20, 171 SEEN_DPI = 0x20,
172 SEEN_FONT = 0x40, 172 SEEN_FONT = 0x40,
173 SEEN_TB_STYLE = 0x80, 173 SEEN_TB_STYLE = 0x80
174}; 174};
175struct xsettings 175struct xsettings
176{ 176{
@@ -687,7 +687,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
687 { 687 {
688 static char const format[] = 688 static char const format[] =
689 "Antialias: %d, Hinting: %d, RGBA: %d, LCDFilter: %d, " 689 "Antialias: %d, Hinting: %d, RGBA: %d, LCDFilter: %d, "
690 "Hintstyle: %d, DPI: %lf"; 690 "Hintstyle: %d, DPI: %f";
691 enum 691 enum
692 { 692 {
693 d_formats = 5, 693 d_formats = 5,
@@ -696,7 +696,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
696 max_f_integer_digits = DBL_MAX_10_EXP + 1, 696 max_f_integer_digits = DBL_MAX_10_EXP + 1,
697 f_precision = 6, 697 f_precision = 6,
698 lf_growth = (sizeof "-." + max_f_integer_digits + f_precision 698 lf_growth = (sizeof "-." + max_f_integer_digits + f_precision
699 - sizeof "%lf") 699 - sizeof "%f")
700 }; 700 };
701 char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; 701 char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth];
702 702
diff --git a/src/xterm.c b/src/xterm.c
index f0b95d585e3..818b69cc41d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2647,7 +2647,10 @@ x_draw_underwave (struct glyph_string *s)
2647 2647
2648 /* Find and set clipping rectangle */ 2648 /* Find and set clipping rectangle */
2649 2649
2650 wave_clip = (XRectangle){ x0, y0, width, wave_height }; 2650 wave_clip.x = x0;
2651 wave_clip.y = y0;
2652 wave_clip.width = width;
2653 wave_clip.height = wave_height;
2651 get_glyph_string_clip_rect (s, &string_clip); 2654 get_glyph_string_clip_rect (s, &string_clip);
2652 2655
2653 if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip)) 2656 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)
10191 } 10194 }
10192 10195
10193 { 10196 {
10194 const struct 10197 static const struct
10195 { 10198 {
10196 const char *name; 10199 const char *name;
10197 Atom *atom; 10200 int offset;
10198 } atom_refs[] = { 10201 } atom_refs[] = {
10199 { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols }, 10202#define ATOM_REFS_INIT(string, member) \
10200 { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus }, 10203 { string, offsetof (struct x_display_info, member) },
10201 { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself }, 10204 ATOM_REFS_INIT ("WM_PROTOCOLS", Xatom_wm_protocols)
10202 { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window }, 10205 ATOM_REFS_INIT ("WM_TAKE_FOCUS", Xatom_wm_take_focus)
10203 { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state }, 10206 ATOM_REFS_INIT ("WM_SAVE_YOURSELF", Xatom_wm_save_yourself)
10204 { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied }, 10207 ATOM_REFS_INIT ("WM_DELETE_WINDOW", Xatom_wm_delete_window)
10205 { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved }, 10208 ATOM_REFS_INIT ("WM_CHANGE_STATE", Xatom_wm_change_state)
10206 { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader }, 10209 ATOM_REFS_INIT ("WM_CONFIGURE_DENIED", Xatom_wm_configure_denied)
10207 { "Editres", &dpyinfo->Xatom_editres }, 10210 ATOM_REFS_INIT ("WM_MOVED", Xatom_wm_window_moved)
10208 { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD }, 10211 ATOM_REFS_INIT ("WM_CLIENT_LEADER", Xatom_wm_client_leader)
10209 { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP }, 10212 ATOM_REFS_INIT ("Editres", Xatom_editres)
10210 { "TEXT", &dpyinfo->Xatom_TEXT }, 10213 ATOM_REFS_INIT ("CLIPBOARD", Xatom_CLIPBOARD)
10211 { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT }, 10214 ATOM_REFS_INIT ("TIMESTAMP", Xatom_TIMESTAMP)
10212 { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING }, 10215 ATOM_REFS_INIT ("TEXT", Xatom_TEXT)
10213 { "DELETE", &dpyinfo->Xatom_DELETE }, 10216 ATOM_REFS_INIT ("COMPOUND_TEXT", Xatom_COMPOUND_TEXT)
10214 { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE }, 10217 ATOM_REFS_INIT ("UTF8_STRING", Xatom_UTF8_STRING)
10215 { "INCR", &dpyinfo->Xatom_INCR }, 10218 ATOM_REFS_INIT ("DELETE", Xatom_DELETE)
10216 { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP }, 10219 ATOM_REFS_INIT ("MULTIPLE", Xatom_MULTIPLE)
10217 { "TARGETS", &dpyinfo->Xatom_TARGETS }, 10220 ATOM_REFS_INIT ("INCR", Xatom_INCR)
10218 { "NULL", &dpyinfo->Xatom_NULL }, 10221 ATOM_REFS_INIT ("_EMACS_TMP_", Xatom_EMACS_TMP)
10219 { "ATOM", &dpyinfo->Xatom_ATOM }, 10222 ATOM_REFS_INIT ("TARGETS", Xatom_TARGETS)
10220 { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR }, 10223 ATOM_REFS_INIT ("NULL", Xatom_NULL)
10221 { "CLIPBOARD_MANAGER", &dpyinfo->Xatom_CLIPBOARD_MANAGER }, 10224 ATOM_REFS_INIT ("ATOM", Xatom_ATOM)
10222 { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO }, 10225 ATOM_REFS_INIT ("ATOM_PAIR", Xatom_ATOM_PAIR)
10226 ATOM_REFS_INIT ("CLIPBOARD_MANAGER", Xatom_CLIPBOARD_MANAGER)
10227 ATOM_REFS_INIT ("_XEMBED_INFO", Xatom_XEMBED_INFO)
10223 /* For properties of font. */ 10228 /* For properties of font. */
10224 { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE }, 10229 ATOM_REFS_INIT ("PIXEL_SIZE", Xatom_PIXEL_SIZE)
10225 { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH }, 10230 ATOM_REFS_INIT ("AVERAGE_WIDTH", Xatom_AVERAGE_WIDTH)
10226 { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET }, 10231 ATOM_REFS_INIT ("_MULE_BASELINE_OFFSET", Xatom_MULE_BASELINE_OFFSET)
10227 { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE }, 10232 ATOM_REFS_INIT ("_MULE_RELATIVE_COMPOSE", Xatom_MULE_RELATIVE_COMPOSE)
10228 { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT }, 10233 ATOM_REFS_INIT ("_MULE_DEFAULT_ASCENT", Xatom_MULE_DEFAULT_ASCENT)
10229 /* Ghostscript support. */ 10234 /* Ghostscript support. */
10230 { "DONE", &dpyinfo->Xatom_DONE }, 10235 ATOM_REFS_INIT ("DONE", Xatom_DONE)
10231 { "PAGE", &dpyinfo->Xatom_PAGE }, 10236 ATOM_REFS_INIT ("PAGE", Xatom_PAGE)
10232 { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar }, 10237 ATOM_REFS_INIT ("SCROLLBAR", Xatom_Scrollbar)
10233 { "_XEMBED", &dpyinfo->Xatom_XEMBED }, 10238 ATOM_REFS_INIT ("_XEMBED", Xatom_XEMBED)
10234 /* EWMH */ 10239 /* EWMH */
10235 { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state }, 10240 ATOM_REFS_INIT ("_NET_WM_STATE", Xatom_net_wm_state)
10236 { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen }, 10241 ATOM_REFS_INIT ("_NET_WM_STATE_FULLSCREEN", Xatom_net_wm_state_fullscreen)
10237 { "_NET_WM_STATE_MAXIMIZED_HORZ", 10242 ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_HORZ",
10238 &dpyinfo->Xatom_net_wm_state_maximized_horz }, 10243 Xatom_net_wm_state_maximized_horz)
10239 { "_NET_WM_STATE_MAXIMIZED_VERT", 10244 ATOM_REFS_INIT ("_NET_WM_STATE_MAXIMIZED_VERT",
10240 &dpyinfo->Xatom_net_wm_state_maximized_vert }, 10245 Xatom_net_wm_state_maximized_vert)
10241 { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, 10246 ATOM_REFS_INIT ("_NET_WM_STATE_STICKY", Xatom_net_wm_state_sticky)
10242 { "_NET_WM_STATE_HIDDEN", &dpyinfo->Xatom_net_wm_state_hidden }, 10247 ATOM_REFS_INIT ("_NET_WM_STATE_HIDDEN", Xatom_net_wm_state_hidden)
10243 { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, 10248 ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE", Xatom_net_window_type)
10244 { "_NET_WM_WINDOW_TYPE_TOOLTIP", 10249 ATOM_REFS_INIT ("_NET_WM_WINDOW_TYPE_TOOLTIP",
10245 &dpyinfo->Xatom_net_window_type_tooltip }, 10250 Xatom_net_window_type_tooltip)
10246 { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, 10251 ATOM_REFS_INIT ("_NET_WM_ICON_NAME", Xatom_net_wm_icon_name)
10247 { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, 10252 ATOM_REFS_INIT ("_NET_WM_NAME", Xatom_net_wm_name)
10248 { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, 10253 ATOM_REFS_INIT ("_NET_SUPPORTED", Xatom_net_supported)
10249 { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check }, 10254 ATOM_REFS_INIT ("_NET_SUPPORTING_WM_CHECK", Xatom_net_supporting_wm_check)
10250 { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, 10255 ATOM_REFS_INIT ("_NET_WM_WINDOW_OPACITY", Xatom_net_wm_window_opacity)
10251 { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, 10256 ATOM_REFS_INIT ("_NET_ACTIVE_WINDOW", Xatom_net_active_window)
10252 { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, 10257 ATOM_REFS_INIT ("_NET_FRAME_EXTENTS", Xatom_net_frame_extents)
10253 { "_NET_CURRENT_DESKTOP", &dpyinfo->Xatom_net_current_desktop }, 10258 ATOM_REFS_INIT ("_NET_CURRENT_DESKTOP", Xatom_net_current_desktop)
10254 { "_NET_WORKAREA", &dpyinfo->Xatom_net_workarea }, 10259 ATOM_REFS_INIT ("_NET_WORKAREA", Xatom_net_workarea)
10255 /* Session management */ 10260 /* Session management */
10256 { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID }, 10261 ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID)
10257 { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop }, 10262 ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop)
10258 { "MANAGER", &dpyinfo->Xatom_xsettings_mgr }, 10263 ATOM_REFS_INIT ("MANAGER", Xatom_xsettings_mgr)
10259 }; 10264 };
10260 10265
10261 int i; 10266 int i;
@@ -10280,7 +10285,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10280 False, atoms_return); 10285 False, atoms_return);
10281 10286
10282 for (i = 0; i < atom_count; i++) 10287 for (i = 0; i < atom_count; i++)
10283 *atom_refs[i].atom = atoms_return[i]; 10288 *(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i];
10284 10289
10285 /* Manual copy of last atom */ 10290 /* Manual copy of last atom */
10286 dpyinfo->Xatom_xsettings_sel = atoms_return[i]; 10291 dpyinfo->Xatom_xsettings_sel = atoms_return[i];