Subject: bug#15880: Compute C declarations for DEFSYMs automatically.

From: Paul Eggert <[email-masked]>
Date: Mon, 05 Jan 2015 11:24:52 -0800

On 01/05/2015 10:56 AM, Eli Zaretskii wrote:
> Did you try to build with --enable-checking?  It fails to compile for
> me:
Works for me.  But your diagnostics show a problem: I forgot to clean 
out the now-harmful static Q* declarations from the w32 files.  Does the 
attached patch fix the problem for you?  I can't easily test it on my 
GNU/Linux platform.
diff --git a/src/msdos.c b/src/msdos.c
index 3c2277e..f0965fc 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -422,8 +422,6 @@ static unsigned long screen_old_address = 0;
 /* Segment and offset of the virtual screen.  If 0, DOS/V is NOT loaded.  */
 static unsigned short screen_virtual_segment = 0;
 static unsigned short screen_virtual_offset = 0;
-extern Lisp_Object Qcursor_type;
-extern Lisp_Object Qbar, Qhbar;
 
 /* The screen colors of the current frame, which serve as the default
    colors for newly-created frames.  */
@@ -1382,13 +1380,6 @@ IT_delete_glyphs (struct frame *f, int n)
   emacs_abort ();
 }
 
-/* This was copied from xfaces.c  */
-
-extern Lisp_Object Qbackground_color;
-extern Lisp_Object Qforeground_color;
-Lisp_Object Qreverse;
-extern Lisp_Object Qtitle;
-
 /* IT_set_terminal_modes is called when emacs is started,
    resumed, and whenever the screen is redrawn!  */
 
diff --git a/src/w32.c b/src/w32.c
index 3237c7b..31b1328 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -242,8 +242,6 @@ typedef struct _REPARSE_DATA_BUFFER {
 typedef HRESULT (WINAPI * ShGetFolderPath_fn)
   (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
 
-Lisp_Object QCloaded_from;
-
 void globals_of_w32 (void);
 static DWORD get_rid (PSID);
 static int is_symlink (const char *);
diff --git a/src/w32.h b/src/w32.h
index a8a525c..835557d 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -172,7 +172,6 @@ extern void init_timers (void);
 extern int _sys_read_ahead (int fd);
 extern int _sys_wait_accept (int fd);
 
-extern Lisp_Object QCloaded_from;
 extern HMODULE w32_delayed_load (Lisp_Object);
 
 extern int (WINAPI *pMultiByteToWideChar)(UINT,DWORD,LPCSTR,int,LPWSTR,int);
diff --git a/src/w32fns.c b/src/w32fns.c
index 26eeb5f..38571d3 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -93,19 +93,6 @@ extern char * w32_strerror (int error_no);
 #define IDC_HAND MAKEINTRESOURCE(32649)
 #endif
 
-Lisp_Object Qundefined_color;
-Lisp_Object Qcancel_timer;
-Lisp_Object Qfont_param;
-Lisp_Object Qhyper;
-Lisp_Object Qsuper;
-Lisp_Object Qmeta;
-Lisp_Object Qalt;
-Lisp_Object Qctrl;
-Lisp_Object Qcontrol;
-Lisp_Object Qshift;
-static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes;
-
-
 /* Prefix for system colors.  */
 #define SYSTEM_COLOR_PREFIX "System"
 #define SYSTEM_COLOR_PREFIX_LEN (sizeof (SYSTEM_COLOR_PREFIX) - 1)
diff --git a/src/w32font.c b/src/w32font.c
index 6b486b7..ab77267 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -57,51 +57,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define JOHAB_CHARSET 130
 #endif
 
-Lisp_Object Qgdi;
-Lisp_Object Quniscribe;
-static Lisp_Object QCformat;
-static Lisp_Object Qmonospace, Qsansserif, Qmono, Qsans, Qsans_serif;
-static Lisp_Object Qserif, Qscript, Qdecorative;
-static Lisp_Object Qraster, Qoutline, Qunknown;
-
-/* antialiasing  */
-static Lisp_Object Qstandard, Qsubpixel, Qnatural;
-
-/* languages */
-static Lisp_Object Qzh;
-
-/* scripts */
-static Lisp_Object Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew;
-static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali;
-static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu;
-static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao;
-static Lisp_Object Qtibetan, Qmyanmar, Qgeorgian, Qhangul, Qethiopic;
-static Lisp_Object Qcherokee, Qcanadian_aboriginal, Qogham, Qrunic;
-static Lisp_Object Qkhmer, Qmongolian, Qbraille, Qhan;
-static Lisp_Object Qideographic_description, Qcjk_misc, Qkana, Qbopomofo;
-static Lisp_Object Qkanbun, Qyi, Qbyzantine_musical_symbol;
-static Lisp_Object Qmusical_symbol, Qmathematical, Qcham, Qphonetic;
-/* Not defined in characters.el, but referenced in fontset.el.  */
-static Lisp_Object Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot;
-static Lisp_Object Qdeseret, Qglagolitic, Qgothic, Qhanunoo, Qkharoshthi;
-static Lisp_Object Qlimbu, Qlinear_b, Qold_italic, Qold_persian, Qosmanya;
-static Lisp_Object Qphags_pa, Qphoenician, Qshavian, Qsyloti_nagri;
-static Lisp_Object Qtagalog, Qtagbanwa, Qtai_le, Qtifinagh, Qugaritic;
-
-/* W32 charsets: for use in Vw32_charset_info_alist.  */
-static Lisp_Object Qw32_charset_ansi, Qw32_charset_default;
-static Lisp_Object Qw32_charset_symbol, Qw32_charset_shiftjis;
-static Lisp_Object Qw32_charset_hangeul, Qw32_charset_gb2312;
-static Lisp_Object Qw32_charset_chinesebig5, Qw32_charset_oem;
-static Lisp_Object Qw32_charset_easteurope, Qw32_charset_turkish;
-static Lisp_Object Qw32_charset_baltic, Qw32_charset_russian;
-static Lisp_Object Qw32_charset_arabic, Qw32_charset_greek;
-static Lisp_Object Qw32_charset_hebrew, Qw32_charset_vietnamese;
-static Lisp_Object Qw32_charset_thai, Qw32_charset_johab, Qw32_charset_mac;
-
-/* Font spacing symbols - defined in font.c.  */
-extern Lisp_Object Qc, Qp, Qm;
-
 static void fill_in_logfont (struct frame *, LOGFONT *, Lisp_Object);
 
 static BYTE w32_antialias_type (Lisp_Object);
diff --git a/src/w32menu.c b/src/w32menu.c
index 72e0cab..7a946d2 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -98,8 +98,6 @@ AppendMenuW_Proc unicode_append_menu = NULL;
 MessageBoxW_Proc unicode_message_box = NULL;
 #endif /* NTGUI_UNICODE */
 
-Lisp_Object Qdebug_on_next_call, Qunsupported__w32_dialog;
-
 void set_frame_menubar (struct frame *, bool, bool);
 
 #ifdef HAVE_DIALOGS
diff --git a/src/w32notify.c b/src/w32notify.c
index 764ded6..0384b32 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -118,10 +118,6 @@ BYTE file_notifications[16384];
 DWORD notifications_size;
 void *notifications_desc;
 
-static Lisp_Object Qfile_name, Qdirectory_name, Qattributes;
-static Lisp_Object Qlast_write_time, Qlast_access_time, Qcreation_time;
-static Lisp_Object Qsecurity_desc, Qsubtree, watch_list;
-
 /* Signal to the main thread that we have file notifications for it to
    process.  */
 static void
diff --git a/src/w32proc.c b/src/w32proc.c
index 0c178e7..26cfa29 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -72,8 +72,6 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
 	    + ((DWORD_PTR)(var) - (section)->VirtualAddress)		\
 	    + (filedata).file_base))
 
-Lisp_Object Qhigh, Qlow;
-
 /* Signal handlers...SIG_DFL == 0 so this is initialized correctly.  */
 static signal_handler sig_handlers[NSIG];
 
diff --git a/src/w32select.c b/src/w32select.c
index f133f6d..b6eaaea 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -107,17 +107,10 @@ static Lisp_Object validate_coding_system (Lisp_Object coding_system);
 static void setup_windows_coding_system (Lisp_Object coding_system,
 					 struct coding_system * coding);
 
-
-/* A remnant from X11: Symbol for the CLIPBORD selection type.  Other
-   selections are not used on Windows, so we don't need symbols for
-   PRIMARY and SECONDARY.  */
-Lisp_Object QCLIPBOARD;
-
 /* Internal pseudo-constants, initialized in globals_of_w32select()
    based on current system parameters. */
 static LCID DEFAULT_LCID;
 static UINT ANSICP, OEMCP;
-static Lisp_Object QUNICODE, QANSICP, QOEMCP;
 
 /* A hidden window just for the clipboard management. */
 static HWND clipboard_owner;
diff --git a/src/w32term.c b/src/w32term.c
index e692d9d..8a53a58 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -220,10 +220,6 @@ static void w32fullscreen_hook (struct frame *);
 static void x_check_font (struct frame *, struct font *);
 #endif
 
-static Lisp_Object Qvendor_specific_keysyms;
-static Lisp_Object Qadded, Qremoved, Qmodified;
-static Lisp_Object Qrenamed_from, Qrenamed_to;
-
 
 /***********************************************************************
 			      Debugging
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 29fea6a..2a7fe2e 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -47,10 +47,6 @@ struct uniscribe_font_info
 
 int uniscribe_available = 0;
 
-/* Defined in w32font.c, since it is required there as well.  */
-extern Lisp_Object Quniscribe;
-extern Lisp_Object Qopentype;
-
 /* EnumFontFamiliesEx callback.  */
 static int CALLBACK ALIGN_STACK add_opentype_font_name_to_list (ENUMLOGFONTEX *,
 								NEWTEXTMETRICEX *,