From: Dmitry Antipov Date: Thu, 5 Sep 2013 06:25:12 +0000 (+0400) Subject: Make --without-x compatible with --enable-gcc-warnings. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/257b3b03cb1cff917e0b3b7832ad3eab5b59f257?hp=98b7f4bdefcc684389bebbd855a02a8097f1bb45 Make --without-x compatible with --enable-gcc-warnings. * configure.ac: If both --without-x and --enable-gcc-warnings are specified, use -Wno-unused-variable, -Wno-unused-but-set-variable and -Wno-unused-but-set-parameter. * src/font.c (register_font_driver): Move check under HAVE_WINDOW_SYSTEM. * src/font.h (struct font_driver): Move draw, get_bitmap and free_bitmap members under HAVE_WINDOW_SYSTEM. * src/keyboard.c (make_lispy_focus_out): Likewise. (record_menu_key): Move under HAVE_MENUS. * src/xdisp.c (toplevel): Move hourglass_shown_p, hourglass_atimer and THIN_SPACE_WIDTH under HAVE_WINDOW_SYSTEM. (syms_of_xdisp): Adjust user. (window_box_edges): Define only if HAVE_WINDOW_SYSTEM. (start_hourglass, cancel_hourglass): * src/xfaces.c (toplevel): Likewise with PT_PER_INCH, clear_font_table_count, CLEAR_FONT_TABLE_COUNT and CLEAR_FONT_TABLE_NFONTS. (set_font_frame_param, clear_face_gcs, realize_non_ascii_face): Declare only if HAVE_WINDOW_SYSTEM. (lface_same_font_attributes_p, clear_face_gcs): Define only if HAVE_WINDOW_SYSTEM. --- diff --git a/ChangeLog b/ChangeLog index b25d30f42c..09cfb9783c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-09-05 Dmitry Antipov + + Make --without-x compatible with --enable-gcc-warnings. + * configure.ac: If both --without-x and --enable-gcc-warnings are + specified, use -Wno-unused-variable, -Wno-unused-but-set-variable + and -Wno-unused-but-set-parameter. + 2013-09-04 Paul Eggert Makefile improvements. diff --git a/configure.ac b/configure.ac index 2d12a8f829..cfec49e564 100644 --- a/configure.ac +++ b/configure.ac @@ -1775,6 +1775,13 @@ fi ## $window_system is now set to the window system we will ## ultimately use. +if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then + # Too many warnings for now. + gl_WARN_ADD([-Wno-unused-variable]) + gl_WARN_ADD([-Wno-unused-but-set-variable]) + gl_WARN_ADD([-Wno-unused-but-set-parameter]) +fi + term_header= HAVE_X_WINDOWS=no HAVE_X11=no diff --git a/src/ChangeLog b/src/ChangeLog index 4a1a168d34..3ef8bee2f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2013-09-05 Dmitry Antipov + + Make --without-x compatible with --enable-gcc-warnings. + * font.c (register_font_driver): Move check under HAVE_WINDOW_SYSTEM. + * font.h (struct font_driver): Move draw, get_bitmap and free_bitmap + members under HAVE_WINDOW_SYSTEM. + * keyboard.c (make_lispy_focus_out): Likewise. + (record_menu_key): Move under HAVE_MENUS. + * xdisp.c (toplevel): Move hourglass_shown_p, hourglass_atimer and + THIN_SPACE_WIDTH under HAVE_WINDOW_SYSTEM. + (syms_of_xdisp): Adjust user. + (window_box_edges): Define only if HAVE_WINDOW_SYSTEM. + (start_hourglass, cancel_hourglass): + * xfaces.c (toplevel): Likewise with PT_PER_INCH, + clear_font_table_count, CLEAR_FONT_TABLE_COUNT + and CLEAR_FONT_TABLE_NFONTS. + (set_font_frame_param, clear_face_gcs, realize_non_ascii_face): + Declare only if HAVE_WINDOW_SYSTEM. + (lface_same_font_attributes_p, clear_face_gcs): Define only + if HAVE_WINDOW_SYSTEM. + 2013-09-05 Dmitry Antipov * frame.c (check_minibuf_window): Update 'frame' with frame pointer. diff --git a/src/font.c b/src/font.c index 6a8262623d..49398e1b87 100644 --- a/src/font.c +++ b/src/font.c @@ -3379,9 +3379,11 @@ register_font_driver (struct font_driver *driver, struct frame *f) struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; struct font_driver_list *prev, *list; +#ifdef HAVE_WINDOW_SYSTEM if (f && ! driver->draw) error ("Unusable font driver for a frame: %s", SDATA (SYMBOL_NAME (driver->type))); +#endif /* HAVE_WINDOW_SYSTEM */ for (prev = NULL, list = root; list; prev = list, list = list->next) if (EQ (list->driver->type, driver->type)) diff --git a/src/font.h b/src/font.h index 3ee579aba2..3e0d97baaa 100644 --- a/src/font.h +++ b/src/font.h @@ -575,6 +575,8 @@ struct font_driver unsigned *code, int nglyphs, struct font_metrics *metrics); +#ifdef HAVE_WINDOW_SYSTEM + /* Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, @@ -595,6 +597,8 @@ struct font_driver Free bitmap data in BITMAP. */ void (*free_bitmap) (struct font *font, struct font_bitmap *bitmap); +#endif /* HAVE_WINDOW_SYSTEM */ + /* Optional. Return an outline data for glyph-code CODE of FONT. The format of the outline data depends on the font-driver. */ diff --git a/src/keyboard.c b/src/keyboard.c index bf7c44aeed..ed70e288c8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -422,7 +422,9 @@ static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object, Lisp_Object *, ptrdiff_t); static Lisp_Object make_lispy_switch_frame (Lisp_Object); static Lisp_Object make_lispy_focus_in (Lisp_Object); +#ifdef HAVE_WINDOW_SYSTEM static Lisp_Object make_lispy_focus_out (Lisp_Object); +#endif /* HAVE_WINDOW_SYSTEM */ static bool help_char_p (Lisp_Object); static void save_getcjmp (sys_jmp_buf); static void restore_getcjmp (sys_jmp_buf); @@ -3210,6 +3212,8 @@ read_char (int commandflag, Lisp_Object map, RETURN_UNGCPRO (c); } +#ifdef HAVE_MENUS + /* Record a key that came from a mouse menu. Record it for echoing, for this-command-keys, and so on. */ @@ -3245,6 +3249,8 @@ record_menu_key (Lisp_Object c) num_input_events++; } +#endif /* HAVE_MENUS */ + /* Return true if should recognize C as "the help character". */ static bool @@ -6069,12 +6075,17 @@ make_lispy_focus_in (Lisp_Object frame) { return list2 (Qfocus_in, frame); } + +#ifdef HAVE_WINDOW_SYSTEM + static Lisp_Object make_lispy_focus_out (Lisp_Object frame) { return list2 (Qfocus_out, frame); } - + +#endif /* HAVE_WINDOW_SYSTEM */ + /* Manipulating modifiers. */ /* Parse the name of SYMBOL, and return the set of modifiers it contains. diff --git a/src/xdisp.c b/src/xdisp.c index d78e78a58d..d68362576f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -760,6 +760,8 @@ Lisp_Object previous_help_echo_string; /* Platform-independent portion of hourglass implementation. */ +#ifdef HAVE_WINDOW_SYSTEM + /* Non-zero means an hourglass cursor is currently shown. */ int hourglass_shown_p; @@ -767,6 +769,8 @@ int hourglass_shown_p; an hourglass cursor on all frames. */ struct atimer *hourglass_atimer; +#endif /* HAVE_WINDOW_SYSTEM */ + /* Name of the face used to display glyphless characters. */ Lisp_Object Qglyphless_char; @@ -776,14 +780,17 @@ static Lisp_Object Qglyphless_char_display; /* Method symbols for Vglyphless_char_display. */ static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width; -/* Default pixel width of `thin-space' display method. */ -#define THIN_SPACE_WIDTH 1 - /* Default number of seconds to wait before displaying an hourglass cursor. */ #define DEFAULT_HOURGLASS_DELAY 1 - +#ifdef HAVE_WINDOW_SYSTEM + +/* Default pixel width of `thin-space' display method. */ +#define THIN_SPACE_WIDTH 1 + +#endif /* HAVE_WINDOW_SYSTEM */ + /* Function prototypes. */ static void setup_for_ellipsis (struct it *, int); @@ -1145,6 +1152,7 @@ window_box (struct window *w, enum glyph_row_area area, int *box_x, } } +#ifdef HAVE_WINDOW_SYSTEM /* Get the bounding box of the display area AREA of window W, without mode lines and both fringes of the window. Return in *TOP_LEFT_X @@ -1163,8 +1171,8 @@ window_box_edges (struct window *w, int *top_left_x, int *top_left_y, *bottom_right_y += *top_left_y; } +#endif /* HAVE_WINDOW_SYSTEM */ - /*********************************************************************** Utilities ***********************************************************************/ @@ -29643,8 +29651,10 @@ cursor shapes. */); doc: /* Seconds to wait before displaying an hourglass pointer when Emacs is busy. */); Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); +#ifdef HAVE_WINDOW_SYSTEM hourglass_atimer = NULL; hourglass_shown_p = 0; +#endif /* HAVE_WINDOW_SYSTEM */ DEFSYM (Qglyphless_char, "glyphless-char"); DEFSYM (Qhex_code, "hex-code"); @@ -29731,13 +29741,14 @@ init_xdisp (void) help_echo_showing_p = 0; } +#ifdef HAVE_WINDOW_SYSTEM + /* Platform-independent portion of hourglass implementation. */ /* Cancel a currently active hourglass timer, and start a new one. */ void start_hourglass (void) { -#if defined (HAVE_WINDOW_SYSTEM) struct timespec delay; cancel_hourglass (); @@ -29762,7 +29773,6 @@ start_hourglass (void) hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, show_hourglass, NULL); -#endif } @@ -29771,7 +29781,6 @@ start_hourglass (void) void cancel_hourglass (void) { -#if defined (HAVE_WINDOW_SYSTEM) if (hourglass_atimer) { cancel_atimer (hourglass_atimer); @@ -29780,5 +29789,6 @@ cancel_hourglass (void) if (hourglass_shown_p) hide_hourglass (); -#endif } + +#endif /* HAVE_WINDOW_SYSTEM */ diff --git a/src/xfaces.c b/src/xfaces.c index a55ac90086..0a117b83c1 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -238,6 +238,11 @@ along with GNU Emacs. If not, see . */ #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO #define GCGraphicsExposures 0 #endif /* HAVE_NS */ + +/* Number of pt per inch (from the TeXbook). */ + +#define PT_PER_INCH 72.27 + #endif /* HAVE_WINDOW_SYSTEM */ #include "buffer.h" @@ -272,10 +277,6 @@ along with GNU Emacs. If not, see . */ #include -/* Number of pt per inch (from the TeXbook). */ - -#define PT_PER_INCH 72.27 - /* Non-zero if face attribute ATTR is unspecified. */ #define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified) @@ -396,6 +397,8 @@ static Lisp_Object Qtty_color_desc, Qtty_color_by_index, Qtty_color_standard_val static Lisp_Object Qtty_color_alist; +#ifdef HAVE_WINDOW_SYSTEM + /* Counter for calls to clear_face_cache. If this counter reaches CLEAR_FONT_TABLE_COUNT, and a frame has more than CLEAR_FONT_TABLE_NFONTS load, unused fonts are freed. */ @@ -404,6 +407,8 @@ static int clear_font_table_count; #define CLEAR_FONT_TABLE_COUNT 100 #define CLEAR_FONT_TABLE_NFONTS 10 +#endif /* HAVE_WINDOW_SYSTEM */ + /* Non-zero means face attributes have been changed since the last redisplay. Used in redisplay_internal. */ @@ -434,29 +439,27 @@ static int ngcs; static int menu_face_changed_default; - -/* Function prototypes. */ - -struct table_entry; struct named_merge_point; -static void set_font_frame_param (Lisp_Object, Lisp_Object); static struct face *realize_face (struct face_cache *, Lisp_Object *, int); -static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, - struct face *); static struct face *realize_x_face (struct face_cache *, Lisp_Object *); static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); static bool realize_basic_faces (struct frame *); static bool realize_default_face (struct frame *); static void realize_named_face (struct frame *, Lisp_Object, int); static struct face_cache *make_face_cache (struct frame *); -static void clear_face_gcs (struct face_cache *); static void free_face_cache (struct face_cache *); static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, int, struct named_merge_point *); - +#ifdef HAVE_WINDOW_SYSTEM +static void set_font_frame_param (Lisp_Object, Lisp_Object); +static void clear_face_gcs (struct face_cache *); +static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, + struct face *); +#endif /* HAVE_WINDOW_SYSTEM */ + /*********************************************************************** Utilities ***********************************************************************/ @@ -3983,6 +3986,7 @@ lface_hash (Lisp_Object *v) ^ XHASH (v[LFACE_HEIGHT_INDEX])); } +#ifdef HAVE_WINDOW_SYSTEM /* Return non-zero if LFACE1 and LFACE2 specify the same font (without considering charsets/registries). They do if they specify the same @@ -4011,8 +4015,8 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2) ); } +#endif /* HAVE_WINDOW_SYSTEM */ - /*********************************************************************** Realized Faces ***********************************************************************/ @@ -4171,6 +4175,7 @@ make_face_cache (struct frame *f) return c; } +#ifdef HAVE_WINDOW_SYSTEM /* Clear out all graphics contexts for all realized faces, except for the basic faces. This should be done from time to time just to avoid @@ -4181,7 +4186,6 @@ clear_face_gcs (struct face_cache *c) { if (c && FRAME_WINDOW_P (c->f)) { -#ifdef HAVE_WINDOW_SYSTEM int i; for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) { @@ -4196,10 +4200,10 @@ clear_face_gcs (struct face_cache *c) unblock_input (); } } -#endif /* HAVE_WINDOW_SYSTEM */ } } +#endif /* HAVE_WINDOW_SYSTEM */ /* Free all realized faces in face cache C, including basic faces. C may be null. If faces are freed, make sure the frame's current