emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cb5af79: Fix compiler warnings in the MinGW build


From: Eli Zaretskii
Subject: [Emacs-diffs] master cb5af79: Fix compiler warnings in the MinGW build
Date: Sat, 21 May 2016 17:08:41 +0000 (UTC)

branch: master
commit cb5af79249c2c9e21405e6237db11935b50dd1c5
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix compiler warnings in the MinGW build
    
    * configure.ac [mingw32]: Don't add -Wpointer-sign, and add
    -Wno-pointer-sign, to keep the noise level down.
    
    * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable
    -Wredundant-decls, as that produces a lot of noise due to
    redeclaration of time-related functions by gnulib.
    * nt/runemacs.c (set_user_model_id): Fix argument type of
    'SetCurrentProcessExplicitAppUserModelID'.
    
    * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't
    declare 'dpyinfo', as it is unused.
    (xpm_load): Fix warnings about pointer signedness.
    * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant
    prototypes.
    (sys_spawnve): Avoid warnings about discarding 'const' qualifier.
    (sys_select): Provide prototype.
    (g_b_init_compare_string_w): Move declaration to file scope.
    * src/w32heap.c (dumped_data_commit): Now static.
    (FREEABLE_P): Avoid warnings about pointer comparison with integer.
    (mmap_realloc): Cast to 'char *' for arithmetics on void pointers.
    * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr)
    (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear):
    Provide prototypes.
    * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove
    redundant prototypes.
    (w32_get_internal_run_time, map_w32_filename): Provide prototype.
    (init_environment, sys_ctime): Avoid warnings about discarding
    'const' qualifier.
    Include utimens.h.
    (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir)
    (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock)
    (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide
    prototypes.
    (sys_rename_replace): Use %d to avoid compiler warnings.
    (_wsa_errlist): Make the message text 'const char *', to avoid
    compilation warnings.
    (dynlib_reset_last_error): Move prototype to file scope.
    (w32_get_resource): First argument is now 'const char *'.
    * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype.
    (otf_features): Second argument is no 'const char *'.
    * src/w32term.c (free_frame_menubar, x_wm_set_size_hint)
    (x_set_window_size): Remove redundant prototypes.
    (XChangeGC, XGetGCValues, w32_draw_underwave)
    (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave)
    (x_calc_absolute_position, x_destroy_window): Now static.
    (menubar_selection_callback): Move prototype to file scope.
    * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant
    declaration.
    (w32_to_x_charset): Fix warnings about discarding 'const' qualifier.
    (w32font_full_name): Fix warnings about implicit conversion of
    'float' to 'double'.
    * src/w32reg.c (w32_get_rdb_resource): Fix warnings about
    discarding 'const' qualifier.
    * src/w32menu.c (syms_of_w32menu, globals_of_w32menu)
    (set_frame_menubar): Remove redundant prototypes.
    (menubar_selection_callback, w32_menu_display_help): Provide
    prototypes.
    (simple_dialog_show): Avoid warnings about discarding 'const'
    qualifier.
    * src/w32fns.c (syms_of_w32fns, globals_of_w32fns)
    (free_frame_menubar, w32_strerror, x_set_menu_bar_lines)
    (x_set_tool_bar_lines, x_set_internal_border_width): Remove
    redundant prototypes.
    (current_popup_menu): Remove redundant declaration.
    (colormap_t): Member 'name' is now 'const char *'.
    (add_system_logical_colors_to_map): Fix signed/unsigned warnings.
    (x_decode_color, x_set_border_pixel)
    (x_clear_under_internal_border, x_set_name, hook_w32_key)
    (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now
    static.
    (w32_load_cursor, w32_key_to_modifier, map_keypad_keys)
    (w32_msg_worker, w32_last_error): Provide prototypes.
    (funhook, lookup_vk_code): Avoid warnings about missing
    parentheses.
    (x_default_font_parameter, Fw32_notification_notify): Avoid
    warnings about discarding 'const' qualifier.
    (Fx_create_frame): Avoid warnings about empty body of 'else'.
    (x_screen_planes): Ifdef away unused function.
    (Fx_show_tip): Remove unused variables.
    (Fw32_battery_status): Avoid warnings about implicit promotion
    from float to double.
    (Fw32_notification_notify): Initialize 'timeout'.
    * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only
    define the TIMER_SETTIME_RUNNING value if it will be used.
    * src/w32notify.c (send_notifications): Ifdef away an empty if
    clause.  Remove unused variable.
    (watch_end, watch_completion): Provide prototypes.
    * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused.
    * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix
    warning with pointer signedness.
    * src/gnutls.c (gnutls_x509_crt_get_signature)
    (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and
    don't load them from the GnuTLS library, as they are no longer
    used.
    * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't
    define, as it's unused.
    * src/unexw32.c (open_input_file, open_output_file)
    (close_file_data): Remove redundant prototypes.
    (_start): provide prototype.
    (mainCRTStartup): Move prototype to file level.
    (find_section): Use type-cast to shut up compiler warnings.
    (offset_to_section, relocate_offset): Now static.
    (find_section): First argument is now a 'const char *'.
    (offset_to_section): Ifdef away, as it's unused.
    * src/w32heap.h (find_section): Adjust prototype.
    * src/dynlib.c (dynlib_reset_last_error): Provide prototype.
    * src/dired.c (directory_files_internal_w32_unwind): Avoid
    warnings about missing prototypes.
    (is_slow_fs) [WINDOWSNT]: Provide prototype at file level.
    (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer
    signedness.
    * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]:
    Fix warnings about pointer signedness.
    * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's
    unused.
    * src/sysdep.c (_getpid): Remove redundant prototype.
    (sys_subshell) [DOS_NT]: Don't define 'status', it's unused.
    [!MSDOS]: Don't define 'st', it's unused.
    (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused.
    (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness.
    * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define
    n_to_read, as it is not used.
    (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused.
    * src/w32font.h (syms_of_w32font): Remove redundant prototype.
    * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro.
    * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are
    not used by DOS_NT builds, to avoid compiler warnings.
    * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant
    declaration.
    * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut
    up compiler warnings.
    * src/w32term.h (x_set_window_size, x_get_focus_frame)
    (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame)
    (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon)
    (x_free_frame_resources, x_real_positions)
    (display_x_get_resource): Remove redundant prototypes.
    
    * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp)
    (sys_rename, gettimeofday): Provide prototypes.
    * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant
    declarations.
    * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'.
    (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname)
    (close_winsock, initialize_sockets, w32_set_user_model_id)
    (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add
    prototypes.
    (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness
    difference.
    (w32_set_user_model_id): Update prototype of
    SetCurrentProcessExplicitAppUserModelID to avoid compiler
    warnings.
    (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to
    shut up compiler warnings.
    * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
---
 configure.ac          |   10 +++++++
 lib-src/emacsclient.c |   32 ++++++++++++++------
 lib-src/etags.c       |    1 -
 lib-src/ntlib.c       |    8 +++++
 lib-src/ntlib.h       |    3 --
 nt/mingw-cfg.site     |    2 ++
 nt/runemacs.c         |    2 +-
 src/callproc.c        |    4 +--
 src/dired.c           |   10 ++++---
 src/dispnew.c         |    2 +-
 src/dynlib.c          |    1 +
 src/fileio.c          |    4 +--
 src/filelock.c        |    2 +-
 src/gnutls.c          |    7 -----
 src/image.c           |    8 ++---
 src/keyboard.c        |    7 +++--
 src/menu.c            |    1 -
 src/process.c         |    1 -
 src/profiler.c        |    7 ++++-
 src/sound.c           |    2 ++
 src/sysdep.c          |   12 ++++----
 src/term.c            |    8 +++--
 src/unexw32.c         |   33 +++++++++++----------
 src/w32.c             |   51 +++++++++++++++++++++++---------
 src/w32.h             |    2 +-
 src/w32console.c      |   22 ++++++++++++++
 src/w32fns.c          |   78 ++++++++++++++++++++++++++-----------------------
 src/w32font.c         |    5 ++--
 src/w32font.h         |    1 -
 src/w32heap.c         |   12 ++++----
 src/w32heap.h         |    4 +--
 src/w32menu.c         |   10 +++----
 src/w32notify.c       |    7 ++++-
 src/w32proc.c         |   13 ++++-----
 src/w32reg.c          |    4 +--
 src/w32select.c       |    1 +
 src/w32term.c         |   28 +++++++++---------
 src/w32term.h         |   18 ------------
 src/w32uniscribe.c    |    6 ++--
 src/xfaces.c          |    1 -
 40 files changed, 252 insertions(+), 178 deletions(-)

diff --git a/configure.ac b/configure.ac
index 22ec494..e88a3a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -967,6 +967,11 @@ AS_IF([test $gl_gcc_warnings = no],
     nw="$nw -Wcast-align"
   fi
 
+  # This causes too much noise in the MinGW build
+  if test $opsys = mingw32; then
+    nw="$nw -Wpointer-sign"
+  fi
+
   gl_MANYWARN_ALL_GCC([ws])
   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
   for w in $ws; do
@@ -987,6 +992,11 @@ AS_IF([test $gl_gcc_warnings = no],
     gl_WARN_ADD([-Wno-unused-value])
   fi
 
+  # This causes too much noise in the MinGW build
+  if test $opsys = mingw32; then
+    gl_WARN_ADD([-Wno-pointer-sign])
+  fi
+
   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
   AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index dd66d34..aab9c4b 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -39,7 +39,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 # define CLOSE_SOCKET closesocket
 # define INITIALIZE() (initialize_sockets ())
 
-char *w32_getenv (char *);
+char *w32_getenv (const char *);
 #define egetenv(VAR) w32_getenv(VAR)
 
 #else /* !WINDOWSNT */
@@ -254,6 +254,7 @@ get_current_dir_name (void)
 #ifdef WINDOWSNT
 
 /* Like strdup but get a fatal error if memory is exhausted. */
+char *xstrdup (const char *);
 
 char *
 xstrdup (const char *s)
@@ -269,11 +270,13 @@ xstrdup (const char *s)
 
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
+char *w32_get_resource (HKEY, const char *, LPDWORD);
+
 /* Retrieve an environment variable from the Emacs subkeys of the registry.
    Return NULL if the variable was not found, or it was empty.
    This code is based on w32_get_resource (w32.c).  */
 char *
-w32_get_resource (HKEY predefined, char *key, LPDWORD type)
+w32_get_resource (HKEY predefined, const char *key, LPDWORD type)
 {
   HKEY hrootkey = NULL;
   char *result = NULL;
@@ -285,7 +288,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
        {
          result = (char *) xmalloc (cbData);
 
-         if ((RegQueryValueEx (hrootkey, key, NULL, type, result, &cbData) != 
ERROR_SUCCESS)
+         if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, 
&cbData) != ERROR_SUCCESS)
              || (*result == 0))
            {
              free (result);
@@ -308,7 +311,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
   environment variables in the registry if they don't appear in the
   environment.  */
 char *
-w32_getenv (char *envvar)
+w32_getenv (const char *envvar)
 {
   char *value;
   DWORD dwType;
@@ -356,6 +359,7 @@ w32_getenv (char *envvar)
   return NULL;
 }
 
+int w32_window_app (void);
 
 int
 w32_window_app (void)
@@ -383,11 +387,13 @@ w32_window_app (void)
   predictably bad results.  By contrast, POSIX execvp passes the arguments
   directly into the argv array of the child process.  */
 
+int w32_execvp (const char *, char **);
+extern int execvp (const char*, char **);
+
 int
 w32_execvp (const char *path, char **argv)
 {
   int i;
-  extern int execvp (const char*, char **);
 
   /* Required to allow a .BAT script as alternate editor.  */
   argv[0] = (char *) alternate_editor;
@@ -407,7 +413,8 @@ w32_execvp (const char *path, char **argv)
 #define execvp w32_execvp
 
 /* Emulation of ttyname for Windows.  */
-char *
+const char *ttyname (int);
+const char *
 ttyname (int fd)
 {
   return "CONOUT$";
@@ -852,6 +859,7 @@ file_name_absolute_p (const char *filename)
 
 #ifdef WINDOWSNT
 /* Wrapper to make WSACleanup a cdecl, as required by atexit.  */
+void __cdecl close_winsock (void);
 void __cdecl
 close_winsock (void)
 {
@@ -859,6 +867,7 @@ close_winsock (void)
 }
 
 /* Initialize the WinSock2 library.  */
+void initialize_sockets (void);
 void
 initialize_sockets (void)
 {
@@ -1380,11 +1389,13 @@ set_socket (int no_exit_if_error)
 FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
 FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
 
+void w32_set_user_model_id (void);
+
 void
 w32_set_user_model_id (void)
 {
   HMODULE shell;
-  HRESULT (WINAPI * set_user_model) (wchar_t * id);
+  HRESULT (WINAPI * set_user_model) (const wchar_t * id);
 
   /* On Windows 7 and later, we need to set the user model ID
      to associate emacsclient launched files with Emacs frames
@@ -1407,6 +1418,8 @@ w32_set_user_model_id (void)
     }
 }
 
+BOOL CALLBACK w32_find_emacs_process (HWND, LPARAM);
+
 BOOL CALLBACK
 w32_find_emacs_process (HWND hWnd, LPARAM lParam)
 {
@@ -1433,6 +1446,7 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam)
 
 /* Search for a window of class "Emacs" and owned by a process with
    process id = emacs_pid.  If found, allow it to grab the focus.  */
+void w32_give_focus (void);
 
 void
 w32_give_focus (void)
@@ -1526,7 +1540,7 @@ start_daemon_and_retry_set_socket (void)
      it is ready to accept client connections, by asserting an event
      whose name is known to the daemon (defined by nt/inc/ms-w32.h).  */
 
-  if (!CreateProcess (NULL, "emacs --daemon", NULL, NULL, FALSE,
+  if (!CreateProcess (NULL, (LPSTR)"emacs --daemon", NULL, NULL, FALSE,
                       CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
     {
       char* msg = NULL;
@@ -1548,7 +1562,7 @@ start_daemon_and_retry_set_socket (void)
   if ((wait_result = WaitForSingleObject (w32_daemon_event, INFINITE))
       != WAIT_OBJECT_0)
     {
-      char *msg = NULL;
+      const char *msg = NULL;
 
       switch (wait_result)
        {
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 570d217..1c85a79 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -112,7 +112,6 @@ char pot_etags_version[] = "@(#) pot revision number is 
17.38.1.4";
 
 #ifdef WINDOWSNT
 # include <direct.h>
-# define MAXPATHLEN _MAX_PATH
 # undef HAVE_NTGUI
 # undef  DOS_NT
 # define DOS_NT
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 4b25796..2ace218 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -34,6 +34,12 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include "ntlib.h"
 
+char *sys_ctime (const time_t *);
+FILE *sys_fopen (const char *, const char *);
+int sys_chdir (const char *);
+int mkostemp (char *, int);
+int sys_rename (const char *, const char *);
+
 /* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
    its system headers.  */
 #ifndef _TIMEZONE_DEFINED
@@ -44,6 +50,8 @@ struct timezone
 };
 #endif
 
+void gettimeofday (struct timeval *, struct timezone *);
+
 #define MAXPATHLEN _MAX_PATH
 
 /* Emulate sleep...we could have done this with a define, but that
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index b49da79..4849dcc 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -34,15 +34,12 @@ char *getwd (char *dir);
 int getppid (void);
 char * getlogin (void);
 char * cuserid (char * s);
-unsigned getuid (void);
-unsigned geteuid (void);
 unsigned getegid (void);
 unsigned getgid (void);
 int setuid (unsigned uid);
 int setregid (unsigned rgid, unsigned gid);
 char * getpass (const char * prompt);
 int fchown (int fd, unsigned uid, unsigned gid);
-int mkostemp (char * template, int flags);
 
 /* redirect or undo interceptions created by config.h */
 #undef access
diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site
index 9d63008..f3c8f81 100644
--- a/nt/mingw-cfg.site
+++ b/nt/mingw-cfg.site
@@ -129,3 +129,5 @@ gl_cv_func_stat_file_slash=yes
 ac_cv_func_random=yes
 # Implemented in w32.c as sys_putenv
 gl_cv_func_svid_putenv=yes
+# GCC warnings that produce too much noise
+gl_cv_warn_c__Wredundant_decls=no
diff --git a/nt/runemacs.c b/nt/runemacs.c
index b5e16c0..9edf148 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -203,7 +203,7 @@ void
 set_user_model_id (void)
 {
   HMODULE shell;
-  HRESULT (WINAPI * set_user_model) (wchar_t * id);
+  HRESULT (WINAPI * set_user_model) (const wchar_t * id);
 
   /* On Windows 7 and later, we need to set the user model ID
      to associate emacsclient launched files with Emacs frames
diff --git a/src/callproc.c b/src/callproc.c
index 3a40626..0729782 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1295,7 +1295,7 @@ child_setup (int in, int out, int err, char **new_argv, 
bool set_pgrp,
 
 #ifdef WINDOWSNT
   prepare_standard_handles (in, out, err, handles);
-  set_process_dir (SDATA (current_dir));
+  set_process_dir (SSDATA (current_dir));
   /* Spawn the child.  (See w32proc.c:sys_spawnve).  */
   cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
   reset_standard_handles (in, out, err, handles);
@@ -1342,7 +1342,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, 
char **value,
          && SBYTES (entry) >= varlen
 #ifdef WINDOWSNT
          /* NT environment variables are case insensitive.  */
-         && ! strnicmp (SDATA (entry), var, varlen)
+         && ! strnicmp (SSDATA (entry), var, varlen)
 #else  /* not WINDOWSNT */
          && ! memcmp (SDATA (entry), var, varlen)
 #endif /* not WINDOWSNT */
diff --git a/src/dired.c b/src/dired.c
index 5d0e327..2dffbb7 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -47,6 +47,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "msdos.h"     /* for fstatat */
 #endif
 
+#ifdef WINDOWSNT
+extern int is_slow_fs (const char *);
+#endif
+
 static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
 static Lisp_Object file_attributes (int, char const *, Lisp_Object);
 
@@ -98,7 +102,7 @@ open_directory (Lisp_Object dirname, int *fdp)
 }
 
 #ifdef WINDOWSNT
-void
+static void
 directory_files_internal_w32_unwind (Lisp_Object arg)
 {
   Vw32_get_true_file_attributes = arg;
@@ -206,8 +210,6 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
 #ifdef WINDOWSNT
   if (attrs)
     {
-      extern int is_slow_fs (const char *);
-
       /* Do this only once to avoid doing it (in w32.c:stat) for each
         file in the directory, when we call Ffile_attributes below.  */
       record_unwind_protect (directory_files_internal_w32_unwind,
@@ -217,7 +219,7 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
        {
          /* w32.c:stat will notice these bindings and avoid calling
             GetDriveType for each file.  */
-         if (is_slow_fs (SDATA (dirfilename)))
+         if (is_slow_fs (SSDATA (dirfilename)))
            Vw32_get_true_file_attributes = Qnil;
          else
            Vw32_get_true_file_attributes = Qt;
diff --git a/src/dispnew.c b/src/dispnew.c
index 4cc908a..82d0b76 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6042,7 +6042,7 @@ init_display (void)
     fatal ("standard input is not a tty");
 
 #ifdef WINDOWSNT
-  terminal_type = "w32console";
+  terminal_type = (char *)"w32console";
 #else
   terminal_type = getenv ("TERM");
 #endif
diff --git a/src/dynlib.c b/src/dynlib.c
index 64f688c..ada5837 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -52,6 +52,7 @@ typedef BOOL (WINAPI *GetModuleHandleExA_Proc) 
(DWORD,LPCSTR,HMODULE*);
 
 /* This needs to be called at startup to countermand any non-zero
    values recorded by temacs.  */
+void dynlib_reset_last_error (void);
 void
 dynlib_reset_last_error (void)
 {
diff --git a/src/fileio.c b/src/fileio.c
index d931808..9da0bf0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2542,7 +2542,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, 
Sfile_writable_p, 1, 1, 0,
   /* The read-only attribute of the parent directory doesn't affect
      whether a file or directory can be created within it.  Some day we
      should check ACLs though, which do affect this.  */
-  return file_directory_p (SDATA (dir)) ? Qt : Qnil;
+  return file_directory_p (SSDATA (dir)) ? Qt : Qnil;
 #else
   return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil;
 #endif
@@ -2773,7 +2773,7 @@ See `file-symlink-p' to distinguish symlinks.  */)
 
     /* Tell stat to use expensive method to get accurate info.  */
     Vw32_get_true_file_attributes = Qt;
-    result = stat (SDATA (absname), &st);
+    result = stat (SSDATA (absname), &st);
     Vw32_get_true_file_attributes = tem;
 
     if (result < 0)
diff --git a/src/filelock.c b/src/filelock.c
index 6201718..2f92e0f 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -65,7 +65,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #define BOOT_TIME_FILE "/var/run/random-seed"
 #endif
 
-#ifndef WTMP_FILE
+#if !defined WTMP_FILE && !defined WINDOWSNT
 #define WTMP_FILE "/var/log/wtmp"
 #endif
 
diff --git a/src/gnutls.c b/src/gnutls.c
index c7efbcc..8ee066f 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -55,7 +55,6 @@ DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get,
            (gnutls_session_t));
 DEF_DLL_FN (const char *, gnutls_alert_get_name,
            (gnutls_alert_description_t));
-DEF_DLL_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int));
 DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials,
            (gnutls_anon_client_credentials_t *));
 DEF_DLL_FN (void, gnutls_anon_free_client_credentials,
@@ -156,8 +155,6 @@ DEF_DLL_FN (int, gnutls_x509_crt_get_subject_unique_id,
            (gnutls_x509_crt_t, char *, size_t *));
 DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm,
            (gnutls_x509_crt_t));
-DEF_DLL_FN (int, gnutls_x509_crt_get_signature,
-           (gnutls_x509_crt_t, char *, size_t *));
 DEF_DLL_FN (int, gnutls_x509_crt_get_key_id,
            (gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size));
 DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t));
@@ -192,7 +189,6 @@ init_gnutls_functions (void)
 
   LOAD_DLL_FN (library, gnutls_alert_get);
   LOAD_DLL_FN (library, gnutls_alert_get_name);
-  LOAD_DLL_FN (library, gnutls_alert_send_appropriate);
   LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials);
   LOAD_DLL_FN (library, gnutls_anon_free_client_credentials);
   LOAD_DLL_FN (library, gnutls_bye);
@@ -255,7 +251,6 @@ init_gnutls_functions (void)
   LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id);
   LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id);
   LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm);
-  LOAD_DLL_FN (library, gnutls_x509_crt_get_signature);
   LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id);
   LOAD_DLL_FN (library, gnutls_sec_param_get_name);
   LOAD_DLL_FN (library, gnutls_sign_get_name);
@@ -282,7 +277,6 @@ init_gnutls_functions (void)
 
 # define gnutls_alert_get fn_gnutls_alert_get
 # define gnutls_alert_get_name fn_gnutls_alert_get_name
-# define gnutls_alert_send_appropriate fn_gnutls_alert_send_appropriate
 # define gnutls_anon_allocate_client_credentials 
fn_gnutls_anon_allocate_client_credentials
 # define gnutls_anon_free_client_credentials 
fn_gnutls_anon_free_client_credentials
 # define gnutls_bye fn_gnutls_bye
@@ -343,7 +337,6 @@ init_gnutls_functions (void)
 # define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id
 # define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm
 # define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial
-# define gnutls_x509_crt_get_signature fn_gnutls_x509_crt_get_signature
 # define gnutls_x509_crt_get_signature_algorithm 
fn_gnutls_x509_crt_get_signature_algorithm
 # define gnutls_x509_crt_get_subject_unique_id 
fn_gnutls_x509_crt_get_subject_unique_id
 # define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version
diff --git a/src/image.c b/src/image.c
index 22bbc35..c1f25aa 100644
--- a/src/image.c
+++ b/src/image.c
@@ -270,12 +270,12 @@ x_create_bitmap_from_data (struct frame *f, char *bits, 
unsigned int width, unsi
 ptrdiff_t
 x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
 {
-  Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
-
 #ifdef HAVE_NTGUI
   return -1;  /* W32_TODO : bitmap support */
 #endif /* HAVE_NTGUI */
 
+  Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
+
 #ifdef HAVE_NS
   ptrdiff_t id;
   void *bitmap = ns_image_from_file (file);
@@ -3677,7 +3677,7 @@ xpm_load (struct frame *f, struct image *img)
 #endif
       /* XpmReadFileToPixmap is not available in the Windows port of
         libxpm.  But XpmReadFileToImage almost does what we want.  */
-      rc = XpmReadFileToImage (&hdc, SDATA (file),
+      rc = XpmReadFileToImage (&hdc, SSDATA (file),
                               &xpm_image, &xpm_mask,
                               &attrs);
 #else
@@ -3701,7 +3701,7 @@ xpm_load (struct frame *f, struct image *img)
 #ifdef HAVE_NTGUI
       /* XpmCreatePixmapFromBuffer is not available in the Windows port
         of libxpm.  But XpmCreateImageFromBuffer almost does what we want.  */
-      rc = XpmCreateImageFromBuffer (&hdc, SDATA (buffer),
+      rc = XpmCreateImageFromBuffer (&hdc, SSDATA (buffer),
                                     &xpm_image, &xpm_mask,
                                     &attrs);
 #else
diff --git a/src/keyboard.c b/src/keyboard.c
index ef2e278..2b5d514 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2193,8 +2193,8 @@ read_decoded_event_from_main_queue (struct timespec 
*end_time,
                                     Lisp_Object prev_event,
                                     bool *used_mouse_menu)
 {
-#define MAX_ENCODED_BYTES 16
 #ifndef WINDOWSNT
+#define MAX_ENCODED_BYTES 16
   Lisp_Object events[MAX_ENCODED_BYTES];
   int n = 0;
 #endif
@@ -6898,7 +6898,10 @@ tty_read_avail_input (struct terminal *terminal,
      the kbd_buffer can really hold.  That may prevent loss
      of characters on some systems when input is stuffed at us.  */
   unsigned char cbuf[KBD_BUFFER_SIZE - 1];
-  int n_to_read, i;
+#ifndef WINDOWSNT
+  int n_to_read;
+#endif
+  int i;
   struct tty_display_info *tty = terminal->display_info.tty;
   int nread = 0;
 #ifdef subprocesses
diff --git a/src/menu.c b/src/menu.c
index 737f2b5..e3d943e 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -47,7 +47,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 # else /* !NTGUI_UNICODE */
 extern AppendMenuW_Proc unicode_append_menu;
 # endif /* NTGUI_UNICODE */
-extern HMENU current_popup_menu;
 #endif /* HAVE_NTGUI  */
 
 #include "menu.h"
diff --git a/src/process.c b/src/process.c
index 3e5b83d..4bb3f0b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -316,7 +316,6 @@ static struct sockaddr_and_len {
    XPROCESS (proc)->infd >= 0 &&                                        \
    datagram_address[XPROCESS (proc)->infd].sa != 0)
 #else
-#define DATAGRAM_CHAN_P(chan)  (0)
 #define DATAGRAM_CONN_P(proc)  (0)
 #endif
 
diff --git a/src/profiler.c b/src/profiler.c
index 844c1f2..07e21ae 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -201,7 +201,12 @@ static bool profiler_timer_ok;
 
 /* Status of sampling profiler.  */
 static enum profiler_cpu_running
-  { NOT_RUNNING, TIMER_SETTIME_RUNNING, SETITIMER_RUNNING }
+  { NOT_RUNNING,
+#ifdef HAVE_ITIMERSPEC
+    TIMER_SETTIME_RUNNING,
+#endif
+    SETITIMER_RUNNING
+  }
   profiler_cpu_running;
 
 /* Hash-table log of CPU profiler.  */
diff --git a/src/sound.c b/src/sound.c
index b9a794b..8671d4a 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -316,6 +316,7 @@ sound_perror (const char *msg)
 }
 
 
+#ifndef WINDOWSNT
 /* Display a warning message.  */
 
 static void
@@ -323,6 +324,7 @@ sound_warning (const char *msg)
 {
   message1 (msg);
 }
+#endif /* !WINDOWSNT */
 
 
 /* Parse sound specification SOUND, and fill ATTRS with what is
diff --git a/src/sysdep.c b/src/sysdep.c
index 53affbf..a99c208 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -107,7 +107,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 /* In process.h which conflicts with the local copy.  */
 #define _P_WAIT 0
 int _cdecl _spawnlp (int, const char *, const char *, ...);
-int _cdecl _getpid (void);
 /* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and
    several prototypes of functions called below.  */
 #include <sys/socket.h>
@@ -507,15 +506,16 @@ void
 sys_subshell (void)
 {
 #ifdef DOS_NT  /* Demacs 1.1.2 91/10/20 Manabu Higashida */
-  int st;
 #ifdef MSDOS
+  int st;
   char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS.  */
 #else
   char oldwd[MAX_UTF8_PATH];
-#endif
+#endif /* MSDOS */
+#else  /* !DOS_NT */
+  int status;
 #endif
   pid_t pid;
-  int status;
   struct save_signal saved_handlers[5];
   char *str = SSDATA (encode_current_directory ());
 
@@ -938,7 +938,9 @@ void
 init_sys_modes (struct tty_display_info *tty_out)
 {
   struct emacs_tty tty;
+#ifndef DOS_NT
   Lisp_Object terminal;
+#endif
 
   Vtty_erase_char = Qnil;
 
@@ -3915,7 +3917,7 @@ str_collate (Lisp_Object s1, Lisp_Object s2,
   int res, err = errno;
 
   errno = 0;
-  res = w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP (ignore_case));
+  res = w32_compare_strings (SSDATA (s1), SSDATA (s2), loc, !NILP 
(ignore_case));
   if (errno)
     error ("Invalid string for collation: %s", strerror (errno));
 
diff --git a/src/term.c b/src/term.c
index 07cc3a9..df583cb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3913,13 +3913,15 @@ dissociate_if_controlling_tty (int fd)
 struct terminal *
 init_tty (const char *name, const char *terminal_type, bool must_succeed)
 {
+  struct tty_display_info *tty = NULL;
+  struct terminal *terminal = NULL;
+#ifndef DOS_NT
   char *area;
   char **address = &area;
   int status;
-  struct tty_display_info *tty = NULL;
-  struct terminal *terminal = NULL;
   sigset_t oldset;
   bool ctty = false;  /* True if asked to open controlling tty.  */
+#endif
 
   if (!terminal_type)
     maybe_fatal (must_succeed, 0,
@@ -3928,8 +3930,10 @@ init_tty (const char *name, const char *terminal_type, 
bool must_succeed)
 
   if (name == NULL)
     name = DEV_TTY;
+#ifndef DOS_NT
   if (!strcmp (name, DEV_TTY))
     ctty = 1;
+#endif
 
   /* If we already have a terminal on the given device, use that.  If
      all such terminals are suspended, create a new one instead.  */
diff --git a/src/unexw32.c b/src/unexw32.c
index 15aa726..f4183dc 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -50,10 +50,6 @@ extern char *my_begbss_static;
 /* Basically, our "initialized" flag.  */
 BOOL using_dynamic_heap = FALSE;
 
-int open_input_file (file_data *p_file, char *name);
-int open_output_file (file_data *p_file, char *name, unsigned long size);
-void close_file_data (file_data *p_file);
-
 void get_section_info (file_data *p_file);
 void copy_executable_and_dump_data (file_data *, file_data *);
 void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile);
@@ -81,14 +77,17 @@ DWORD_PTR  extra_bss_size_static = 0;
 #define _start __start
 #endif
 
+extern void mainCRTStartup (void);
+
 /* Startup code for running on NT.  When we are running as the dumped
    version, we need to bootstrap our heap and .bss section into our
    address space before we can actually hand off control to the startup
    code supplied by NT (primarily because that code relies upon malloc ()).  */
+void _start (void);
+
 void
 _start (void)
 {
-  extern void mainCRTStartup (void);
 
 #if 1
   /* Give us a way to debug problems with crashes on startup when
@@ -205,7 +204,7 @@ close_file_data (file_data *p_file)
 
 /* Return pointer to section header for named section. */
 IMAGE_SECTION_HEADER *
-find_section (char * name, IMAGE_NT_HEADERS * nt_header)
+find_section (const char * name, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
   int i;
@@ -214,7 +213,7 @@ find_section (char * name, IMAGE_NT_HEADERS * nt_header)
 
   for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
     {
-      if (strcmp (section->Name, name) == 0)
+      if (strcmp ((char *)section->Name, name) == 0)
        return section;
       section++;
     }
@@ -249,9 +248,10 @@ rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * 
nt_header)
   return NULL;
 }
 
+#if 0  /* unused */
 /* Return pointer to section header for section containing the given
    offset in its raw data area. */
-IMAGE_SECTION_HEADER *
+static IMAGE_SECTION_HEADER *
 offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
@@ -268,11 +268,12 @@ offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * 
nt_header)
     }
   return NULL;
 }
+#endif
 
 /* Return offset to an object in dst, given offset in src.  We assume
    there is at least one section in both src and dst images, and that
    the some sections may have been added to dst (after sections in src).  */
-DWORD_PTR
+static DWORD_PTR
 relocate_offset (DWORD_PTR offset,
                 IMAGE_NT_HEADERS * src_nt_header,
                 IMAGE_NT_HEADERS * dst_nt_header)
@@ -306,9 +307,6 @@ relocate_offset (DWORD_PTR offset,
     (dst_section->PointerToRawData - src_section->PointerToRawData);
 }
 
-#define OFFSET_TO_RVA(offset, section) \
-  ((section)->VirtualAddress + ((DWORD_PTR)(offset) - 
(section)->PointerToRawData))
-
 #define RVA_TO_OFFSET(rva, section) \
   ((section)->PointerToRawData + ((DWORD_PTR)(rva) - 
(section)->VirtualAddress))
 
@@ -318,15 +316,20 @@ relocate_offset (DWORD_PTR offset,
 /* Convert address in executing image to RVA.  */
 #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
 
-#define RVA_TO_PTR(var,section,filedata) \
-         ((unsigned char *)(RVA_TO_OFFSET (var,section) + 
(filedata).file_base))
-
 #define PTR_TO_OFFSET(ptr, pfile_data) \
           ((unsigned char *)(ptr) - (pfile_data)->file_base)
 
 #define OFFSET_TO_PTR(offset, pfile_data) \
           ((pfile_data)->file_base + (DWORD_PTR)(offset))
 
+#if 0  /* unused */
+#define OFFSET_TO_RVA(offset, section) \
+  ((section)->VirtualAddress + ((DWORD_PTR)(offset) - 
(section)->PointerToRawData))
+
+#define RVA_TO_PTR(var,section,filedata) \
+         ((unsigned char *)(RVA_TO_OFFSET (var,section) + 
(filedata).file_base))
+#endif
+
 
 /* Flip through the executable and cache the info necessary for dumping.  */
 void
diff --git a/src/w32.c b/src/w32.c
index 94aa7d8..442ce79 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -66,6 +66,24 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #undef localtime
 
+char *sys_ctime (const time_t *);
+int sys_chdir (const char *);
+int sys_creat (const char *, int);
+FILE *sys_fopen (const char *, const char *);
+int sys_mkdir (const char *);
+int sys_open (const char *, int, int);
+int sys_rename (char const *, char const *);
+int sys_rmdir (const char *);
+int sys_close (int);
+int sys_dup2 (int, int);
+int sys_read (int, char *, unsigned int);
+int sys_write (int, const void *, unsigned int);
+struct tm *sys_localtime (const time_t *);
+
+#ifdef HAVE_MODULES
+extern void dynlib_reset_last_error (void);
+#endif
+
 #include "lisp.h"
 #include "epaths.h"    /* for PATH_EXEC */
 
@@ -227,6 +245,7 @@ typedef struct _REPARSE_DATA_BUFFER {
 #include <wincrypt.h>
 
 #include <c-strcase.h>
+#include <utimens.h>   /* for fdutimens */
 
 #include "w32.h"
 #include <dirent.h>
@@ -246,7 +265,6 @@ typedef struct _REPARSE_DATA_BUFFER {
 typedef HRESULT (WINAPI * ShGetFolderPath_fn)
   (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
 
-void globals_of_w32 (void);
 static DWORD get_rid (PSID);
 static int is_symlink (const char *);
 static char * chase_symlinks (const char *);
@@ -512,6 +530,8 @@ static Lisp_Object ltime (ULONGLONG);
 /* Get total user and system times for get-internal-run-time.
    Returns a list of integers if the times are provided by the OS
    (NT derivatives), otherwise it returns the result of current-time. */
+Lisp_Object w32_get_internal_run_time (void);
+
 Lisp_Object
 w32_get_internal_run_time (void)
 {
@@ -2491,7 +2511,7 @@ sys_putenv (char *str)
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
 LPBYTE
-w32_get_resource (char *key, LPDWORD lpdwtype)
+w32_get_resource (const char *key, LPDWORD lpdwtype)
 {
   LPBYTE lpvalue;
   HKEY hrootkey = NULL;
@@ -2600,8 +2620,8 @@ init_environment (char ** argv)
 
     static const struct env_entry
     {
-      char * name;
-      char * def_value;
+      const char * name;
+      const char * def_value;
     } dflt_envvars[] =
     {
       /* If the default value is NULL, we will use the value from the
@@ -2761,14 +2781,14 @@ init_environment (char ** argv)
                        {
                          /* If not found in any directory, use the
                             default as the last resort.  */
-                         lpval = env_vars[i].def_value;
+                         lpval = (char *)env_vars[i].def_value;
                          dwType = REG_EXPAND_SZ;
                        }
                    } while (*pstart);
                  }
                else
                  {
-                   lpval = env_vars[i].def_value;
+                   lpval = (char *)env_vars[i].def_value;
                    dwType = REG_EXPAND_SZ;
                  }
                if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
@@ -2786,7 +2806,7 @@ init_environment (char ** argv)
                if (dwType == REG_EXPAND_SZ)
                  ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof (buf1));
                else if (dwType == REG_SZ)
-                 strcpy (buf1, lpval);
+                 strcpy (buf1, (char *)lpval);
                if (dwType == REG_EXPAND_SZ || dwType == REG_SZ)
                  {
                    _snprintf (buf2, sizeof (buf2)-1, "%s=%s", env_vars[i].name,
@@ -2961,7 +2981,7 @@ char *
 sys_ctime (const time_t *t)
 {
   char *str = (char *) ctime (t);
-  return (str ? str : "Sun Jan 01 00:00:00 1970");
+  return (str ? str : (char *)"Sun Jan 01 00:00:00 1970");
 }
 
 /* Emulate sleep...we could have done this with a define, but that
@@ -3225,6 +3245,8 @@ is_fat_volume (const char * name, const char ** pPath)
 /* Convert all slashes in a filename to backslashes, and map filename
    to a valid 8.3 name if necessary.  The result is a pointer to a
    static buffer, so CAVEAT EMPTOR!  */
+const char *map_w32_filename (const char *, const char **);
+
 const char *
 map_w32_filename (const char * name, const char ** pPath)
 {
@@ -4430,7 +4452,7 @@ sys_rename_replace (const char *oldname, const char 
*newname, BOOL force)
        {
          /* Force temp name to require a manufactured 8.3 alias - this
             seems to make the second rename work properly.  */
-         sprintf (p, "_.%s.%u", o, i);
+         sprintf (p, "_.%s.%d", o, i);
          i++;
          result = rename (oldname_a, temp_a);
        }
@@ -4858,6 +4880,8 @@ get_file_owner_and_group (PSECURITY_DESCRIPTOR psd, 
struct stat *st)
 }
 
 /* Return non-zero if NAME is a potentially slow filesystem.  */
+int is_slow_fs (const char *);
+
 int
 is_slow_fs (const char *name)
 {
@@ -7215,6 +7239,8 @@ BOOL (WINAPI *pfn_SetHandleInformation) (HANDLE object, 
DWORD mask, DWORD flags)
 HANDLE winsock_lib;
 static int winsock_inuse;
 
+BOOL term_winsock (void);
+
 BOOL
 term_winsock (void)
 {
@@ -7372,7 +7398,7 @@ check_errno (void)
 /* Extend strerror to handle the winsock-specific error codes.  */
 struct {
   int errnum;
-  char * msg;
+  const char * msg;
 } _wsa_errlist[] = {
   {WSAEINTR                , "Interrupted function call"},
   {WSAEBADF                , "Bad file descriptor"},
@@ -7456,7 +7482,7 @@ sys_strerror (int error_no)
 
   for (i = 0; _wsa_errlist[i].errnum >= 0; i++)
     if (_wsa_errlist[i].errnum == error_no)
-      return _wsa_errlist[i].msg;
+      return (char *)_wsa_errlist[i].msg;
 
   sprintf (unknown_msg, "Unidentified error: %d", error_no);
   return unknown_msg;
@@ -8905,8 +8931,6 @@ sys_write (int fd, const void * buffer, unsigned int 
count)
 
 /* Emulation of SIOCGIFCONF and getifaddrs, see process.c.  */
 
-extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, ptrdiff_t);
-
 /* Return information about network interface IFNAME, or about all
    interfaces (if IFNAME is nil).  */
 static Lisp_Object
@@ -9619,7 +9643,6 @@ globals_of_w32 (void)
     w32_unicode_filenames = 1;
 
 #ifdef HAVE_MODULES
-  extern void dynlib_reset_last_error (void);
   dynlib_reset_last_error ();
 #endif
 
diff --git a/src/w32.h b/src/w32.h
index 42a1c42..702bb52 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -162,7 +162,7 @@ extern void reset_standard_handles (int in, int out,
                                    int err, HANDLE handles[4]);
 
 /* Return the string resource associated with KEY of type TYPE.  */
-extern LPBYTE w32_get_resource (char * key, LPDWORD type);
+extern LPBYTE w32_get_resource (const char * key, LPDWORD type);
 
 extern void release_listen_threads (void);
 extern void init_ntproc (int);
diff --git a/src/w32console.c b/src/w32console.c
index 82ba4b1..98343a6 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -35,6 +35,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "w32common.h" /* for os_subtype */
 #include "w32inevt.h"
 
+#ifdef WINDOWSNT
+#include "w32.h"       /* for syms_of_ntterm */
+#endif
+
 static void w32con_move_cursor (struct frame *f, int row, int col);
 static void w32con_clear_to_end (struct frame *f);
 static void w32con_clear_frame (struct frame *f);
@@ -67,6 +71,8 @@ int w32_console_unicode_input;
    someone hits ^C in a 'suspended' session (child shell).
    Also ignore Ctrl-Break signals.  */
 
+BOOL ctrl_c_handler (unsigned long);
+
 BOOL
 ctrl_c_handler (unsigned long type)
 {
@@ -509,11 +515,15 @@ w32con_update_end (struct frame * f)
                        stubs from termcap.c
  ***********************************************************************/
 
+void sys_tputs (char *, int, int (*) (int));
+
 void
 sys_tputs (char *str, int nlines, int (*outfun) (int))
 {
 }
 
+char *sys_tgetstr (char *, char **);
+
 char *
 sys_tgetstr (char *cap, char **area)
 {
@@ -528,33 +538,45 @@ sys_tgetstr (char *cap, char **area)
 struct tty_display_info *current_tty = NULL;
 int cost = 0;
 
+int evalcost (int);
+
 int
 evalcost (int c)
 {
   return c;
 }
 
+int cmputc (int);
+
 int
 cmputc (int c)
 {
   return c;
 }
 
+void cmcheckmagic (struct tty_display_info *);
+
 void
 cmcheckmagic (struct tty_display_info *tty)
 {
 }
 
+void cmcostinit (struct tty_display_info *);
+
 void
 cmcostinit (struct tty_display_info *tty)
 {
 }
 
+void cmgoto (struct tty_display_info *, int, int);
+
 void
 cmgoto (struct tty_display_info *tty, int row, int col)
 {
 }
 
+void Wcm_clear (struct tty_display_info *);
+
 void
 Wcm_clear (struct tty_display_info *tty)
 {
diff --git a/src/w32fns.c b/src/w32fns.c
index 7a1f84a..fa45b47 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -74,15 +74,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #define FOF_NO_CONNECTED_ELEMENTS 0x2000
 #endif
 
-void syms_of_w32fns (void);
-void globals_of_w32fns (void);
-
-extern void free_frame_menubar (struct frame *);
 extern int w32_console_toggle_lock_key (int, Lisp_Object);
 extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
 extern void w32_free_menu_strings (HWND);
 extern const char *map_w32_filename (const char *, const char **);
-extern char * w32_strerror (int error_no);
 
 #ifndef IDC_HAND
 #define IDC_HAND MAKEINTRESOURCE(32649)
@@ -222,7 +217,6 @@ static HWND w32_visible_system_caret_hwnd;
 static int w32_unicode_gui;
 
 /* From w32menu.c  */
-extern HMENU current_popup_menu;
 int menubar_in_use = 0;
 
 /* From w32uniscribe.c  */
@@ -365,10 +359,7 @@ void x_set_cursor_type (struct frame *, Lisp_Object, 
Lisp_Object);
 void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
 void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
 void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-void x_set_internal_border_width (struct frame *f, Lisp_Object, Lisp_Object);
 
 
 /* Store the screen positions of frame F into XPTR and YPTR.
@@ -491,7 +482,7 @@ if the entry is new.  */)
 /* The default colors for the w32 color map */
 typedef struct colormap_t
 {
-  char *name;
+  const char *name;
   COLORREF colorref;
 } colormap_t;
 
@@ -829,7 +820,7 @@ add_system_logical_colors_to_map (Lisp_Object 
*system_colors)
                            NULL, NULL, (LPBYTE)color_buffer, &color_size)
             == ERROR_SUCCESS)
        {
-         int r, g, b;
+         unsigned r, g, b;
          if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3)
            *system_colors = Fcons (Fcons (build_string (full_name_buffer),
                                           make_number (RGB (r, g, b))),
@@ -1244,7 +1235,7 @@ w32_defined_color (struct frame *f, const char *color, 
XColor *color_def,
    If F is not a color screen, return DEF (default) regardless of what
    ARG says.  */
 
-int
+static int
 x_decode_color (struct frame *f, Lisp_Object arg, int def)
 {
   XColor cdef;
@@ -1527,7 +1518,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
    Note that this does not fully take effect if done before
    F has a window.  */
 
-void
+static void
 x_set_border_pixel (struct frame *f, int pix)
 {
 
@@ -1638,7 +1629,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 #endif
 }
 
-void
+static void
 x_clear_under_internal_border (struct frame *f)
 {
   int border = FRAME_INTERNAL_BORDER_WIDTH (f);
@@ -1864,7 +1855,7 @@ w32_set_title_bar_text (struct frame *f, Lisp_Object name)
        suggesting a new name, which lisp code should override; if
        F->explicit_name is set, ignore the new name; otherwise, set it.  */
 
-void
+static void
 x_set_name (struct frame *f, Lisp_Object name, bool explicit)
 {
   /* Make sure that requests from lisp code override requests from
@@ -1969,6 +1960,8 @@ x_set_scroll_bar_default_height (struct frame *f)
 
 /* Subroutines for creating a frame.  */
 
+Cursor w32_load_cursor (LPCTSTR);
+
 Cursor
 w32_load_cursor (LPCTSTR name)
 {
@@ -2189,8 +2182,8 @@ funhook (int code, WPARAM w, LPARAM l)
                     can prevent this by setting the
                     w32-pass-[lr]window-to-system variable to
                     NIL.  */
-                 if (hs->vkCode == VK_LWIN && !NILP 
(Vw32_pass_lwindow_to_system) ||
-                     hs->vkCode == VK_RWIN && !NILP 
(Vw32_pass_rwindow_to_system))
+                 if (hs->vkCode == (VK_LWIN && !NILP 
(Vw32_pass_lwindow_to_system)) ||
+                     (hs->vkCode == VK_RWIN && !NILP 
(Vw32_pass_rwindow_to_system)))
                    {
                      /* Not prevented - Simulate the keypress to the system.  
*/
                      memset (inputs, 0, sizeof (inputs));
@@ -2236,8 +2229,8 @@ funhook (int code, WPARAM w, LPARAM l)
       /* Some other key was pressed while a captured Win key is down.
         This is either an Emacs registered hotkey combination, or a
         system hotkey.  */
-      if (kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode] ||
-         kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode])
+      if ((kbdhook.lwindown && kbdhook.lwin_hooked[hs->vkCode]) ||
+         (kbdhook.rwindown && kbdhook.rwin_hooked[hs->vkCode]))
        {
          /* Hooked Win-x combination, do not pass the keypress to Windows.  */
          kbdhook.suppress_lone = 1;
@@ -2375,7 +2368,7 @@ remove_w32_kbdhook (void)
 
 /* Mark a specific key combination as hooked, preventing it to be
    handled by the system.  */
-void
+static void
 hook_w32_key (int hook, int modifier, int vkey)
 {
   char *tbl = NULL;
@@ -2445,7 +2438,7 @@ check_w32_winkey_state (int vkey)
    leaves the Win key(s) "down" from the hook's point of view - the
    keyup event is never seen.  Thus, this function must be called when
    the system is locked.  */
-void
+static void
 reset_w32_kbdhook_state (void)
 {
   kbdhook.lwindown = 0;
@@ -2652,6 +2645,7 @@ modifier_set (int vkey)
 
 /* Convert between the modifier bits W32 uses and the modifier bits
    Emacs uses.  */
+unsigned int w32_key_to_modifier (int);
 
 unsigned int
 w32_key_to_modifier (int key)
@@ -2750,6 +2744,8 @@ w32_get_key_modifiers (unsigned int wparam, unsigned int 
lparam)
   return mods;
 }
 
+unsigned int map_keypad_keys (unsigned int, unsigned int);
+
 unsigned int
 map_keypad_keys (unsigned int virt_key, unsigned int extended)
 {
@@ -3122,6 +3118,8 @@ cancel_all_deferred_msgs (void)
   PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
 }
 
+DWORD WINAPI w32_msg_worker (void *);
+
 DWORD WINAPI
 w32_msg_worker (void *arg)
 {
@@ -3340,7 +3338,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int 
ignore_ctrl, int ctrl,
    Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */
 static int after_deadkey = -1;
 
-int
+static int
 deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam,
                  UINT lParam, int legacy_alt_meta)
 {
@@ -5267,7 +5265,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object 
parms)
   if (!STRINGP (font))
     {
       int i;
-      static char *names[]
+      static const char *names[]
        = { "Courier New-10",
            "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1",
            "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1",
@@ -5610,8 +5608,10 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
       else if (! NILP (visibility))
        x_make_frame_visible (f);
       else
-       /* Must have been Qnil.  */
-       ;
+       {
+         /* Must have been Qnil.  */
+         ;
+       }
     }
 
   /* Initialize `default-minibuffer-frame' in case this is the first
@@ -6154,11 +6154,13 @@ SOUND is nil to use the normal beep.  */)
   return sound;
 }
 
+#if 0  /* unused */
 int
 x_screen_planes (register struct frame *f)
 {
   return FRAME_DISPLAY_INFO (f)->n_planes;
 }
+#endif
 
 /* Return the display structure for the display named NAME.
    Open a new connection if necessary.  */
@@ -6886,12 +6888,12 @@ A tooltip's maximum size is specified by 
`x-max-tooltip-size'.
 Text larger than the specified size is clipped.  */)
   (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object 
timeout, Lisp_Object dx, Lisp_Object dy)
 {
-  struct frame *f, *tip_f;
+  struct frame *tip_f;
   struct window *w;
   int root_x, root_y;
   struct buffer *old_buffer;
   struct text_pos pos;
-  int i, width, height;
+  int width, height;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t count_1;
@@ -6900,7 +6902,7 @@ Text larger than the specified size is clipped.  */)
   specbind (Qinhibit_redisplay, Qt);
 
   CHECK_STRING (string);
-  f = decode_window_system_frame (frame);
+  decode_window_system_frame (frame);
   if (NILP (timeout))
     timeout = make_number (5);
   else
@@ -8032,8 +8034,8 @@ lookup_vk_code (char *key)
       /* Alphanumerics map to themselves.  */
       if (key[1] == 0)
       {
-       if (key[0] >= 'A' && key[0] <= 'Z' ||
-           key[0] >= '0' && key[0] <= '9')
+       if ((key[0] >= 'A' && key[0] <= 'Z')
+           || (key[0] >= '0' && key[0] <= '9'))
          return key[0];
        if (key[0] >= 'a' && key[0] <= 'z')
          return toupper(key[0]);
@@ -8667,7 +8669,7 @@ The following %-sequences are provided:
       else
        {
          long m;
-         float h;
+         double h;
          char buffer[16];
          snprintf (buffer, 16, "%ld", seconds_left);
          seconds = build_string (buffer);
@@ -8968,6 +8970,8 @@ w32_strerror (int error_no)
 /* For convenience when debugging.  (You cannot call GetLastError
    directly from GDB: it will crash, because it uses the __stdcall
    calling convention, not the _cdecl convention assumed by GDB.)  */
+DWORD w32_last_error (void);
+
 DWORD
 w32_last_error (void)
 {
@@ -9618,7 +9622,7 @@ usage: (w32-notification-notify &rest PARAMS)  */)
   EMACS_INT retval;
   char *icon, *tip, *title, *msg;
   enum NI_Severity severity;
-  unsigned timeout;
+  unsigned timeout = 0;
 
   if (nargs == 0)
     return Qnil;
@@ -9630,14 +9634,14 @@ usage: (w32-notification-notify &rest PARAMS)  */)
   if (STRINGP (lres))
     icon = SSDATA (ENCODE_FILE (Fexpand_file_name (lres, Qnil)));
   else
-    icon = "";
+    icon = (char *)"";
 
   /* Tip.  */
   lres = Fplist_get (arg_plist, QCtip);
   if (STRINGP (lres))
     tip = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
   else
-    tip = "Emacs notification";
+    tip = (char *)"Emacs notification";
 
   /* Severity.  */
   lres = Fplist_get (arg_plist, QClevel);
@@ -9657,14 +9661,14 @@ usage: (w32-notification-notify &rest PARAMS)  */)
   if (STRINGP (lres))
     title = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
   else
-    title = "";
+    title = (char *)"";
 
   /* Notification body text.  */
   lres = Fplist_get (arg_plist, QCbody);
   if (STRINGP (lres))
     msg = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1));
   else
-    msg = "";
+    msg = (char *)"";
 
   /* Do it!  */
   retval = add_tray_notification (f, icon, tip, severity, timeout, title, msg);
@@ -10254,7 +10258,7 @@ typedef USHORT (WINAPI * CaptureStackBackTrace_proc) 
(ULONG, ULONG, PVOID *,
 
 #define BACKTRACE_LIMIT_MAX 62
 
-int
+static int
 w32_backtrace (void **buffer, int limit)
 {
   static CaptureStackBackTrace_proc s_pfn_CaptureStackBackTrace = NULL;
diff --git a/src/w32font.c b/src/w32font.c
index 018e657..b8884a5 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -102,7 +102,6 @@ static void list_all_matching_fonts (struct 
font_callback_data *);
 static BOOL g_b_init_get_outline_metrics_w;
 static BOOL g_b_init_get_text_metrics_w;
 static BOOL g_b_init_get_glyph_outline_w;
-static BOOL g_b_init_get_glyph_outline_w;
 static BOOL g_b_init_get_char_width_32_w;
 
 typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) (
@@ -1688,7 +1687,7 @@ w32_to_x_charset (int fncharset, char *matching)
       /* Handle startup case of w32-charset-info-alist not
          being set up yet. */
       if (NILP (Vw32_charset_info_alist))
-        return "iso8859-1";
+        return (char *)"iso8859-1";
       charset_type = Qw32_charset_ansi;
       break;
     case DEFAULT_CHARSET:
@@ -2355,7 +2354,7 @@ w32font_full_name (LOGFONT * font, Lisp_Object font_obj,
     {
       if (outline)
         {
-          float pointsize = height * 72.0 / one_w32_display_info.resy;
+          double pointsize = height * 72.0 / one_w32_display_info.resy;
           /* Round to nearest half point.  floor is used, since round is not
             supported in MS library.  */
           pointsize = floor (pointsize * 2 + 0.5) / 2;
diff --git a/src/w32font.h b/src/w32font.h
index 728ad8b..0e2d0f7 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -84,7 +84,6 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
 
 Lisp_Object intern_font_name (char *);
 
-extern void syms_of_w32font (void);
 extern void globals_of_w32font (void);
 
 #endif
diff --git a/src/w32heap.c b/src/w32heap.c
index 6643b43..658a8a5 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -189,7 +189,7 @@ free_fn the_free_fn;
    claims for new memory.  Before dumping, we allocate space
    from the fixed size dumped_data[] array.
 */
-NTSTATUS NTAPI
+static NTSTATUS NTAPI
 dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize)
 {
   /* This is used before dumping.
@@ -323,9 +323,9 @@ init_heap (void)
 
 /* FREEABLE_P checks if the block can be safely freed.  */
 #define FREEABLE_P(addr)                                               \
-    ((unsigned char *)(addr) > 0                                       \
-     && ((unsigned char *)(addr) < dumped_data                         \
-        || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE))
+  ((DWORD_PTR)(unsigned char *)(addr) > 0                              \
+   && ((unsigned char *)(addr) < dumped_data                           \
+       || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE))
 
 void *
 malloc_after_dump (size_t size)
@@ -708,7 +708,7 @@ mmap_realloc (void **var, size_t nbytes)
   if (memInfo.RegionSize < nbytes)
     {
       memset (&m2, 0, sizeof (m2));
-      if (VirtualQuery (*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0)
+      if (VirtualQuery ((char *)*var + memInfo.RegionSize, &m2, sizeof(m2)) == 
0)
         DebPrint (("mmap_realloc: VirtualQuery error = %ld\n",
                   GetLastError ()));
       /* If there is enough room in the current reserved area, then
@@ -778,7 +778,7 @@ mmap_realloc (void **var, size_t nbytes)
         }
 
       /* We still can decommit pages.  */
-      if (VirtualFree (*var + nbytes + get_page_size(),
+      if (VirtualFree ((char *)*var + nbytes + get_page_size(),
                       memInfo.RegionSize - nbytes - get_page_size(),
                       MEM_DECOMMIT) == 0)
         DebPrint (("mmap_realloc: VirtualFree error %ld\n", GetLastError ()));
diff --git a/src/w32heap.h b/src/w32heap.h
index 523bceb..4f2d6c8 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -61,10 +61,10 @@ int open_output_file (file_data *p_file, char *name, 
unsigned long size);
 void close_file_data (file_data *p_file);
 
 /* Return pointer to section header for named section.  */
-IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * 
nt_header);
+IMAGE_SECTION_HEADER * find_section (const char *, IMAGE_NT_HEADERS *);
 
 /* Return pointer to section header for section containing the given
    relative virtual address.  */
-IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * 
nt_header);
+IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR, IMAGE_NT_HEADERS *);
 
 #endif /* NTHEAP_H_ */
diff --git a/src/w32menu.c b/src/w32menu.c
index d9ab8f5..fecbf33 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -60,9 +60,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 HMENU current_popup_menu;
 
-void syms_of_w32menu (void);
-void globals_of_w32menu (void);
-
 typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) (
     IN HMENU,
     IN UINT,
@@ -91,8 +88,6 @@ AppendMenuW_Proc unicode_append_menu = NULL;
 MessageBoxW_Proc unicode_message_box = NULL;
 #endif /* NTGUI_UNICODE */
 
-void set_frame_menubar (struct frame *, bool, bool);
-
 #ifdef HAVE_DIALOGS
 static Lisp_Object w32_dialog_show (struct frame *, Lisp_Object, Lisp_Object, 
char **);
 #else
@@ -172,6 +167,7 @@ x_activate_menubar (struct frame *f)
    when the user makes a selection.
    Figure out what the user chose
    and put the appropriate events into the keyboard buffer.  */
+void menubar_selection_callback (struct frame *, void *);
 
 void
 menubar_selection_callback (struct frame *f, void * client_data)
@@ -1111,7 +1107,7 @@ simple_dialog_show (struct frame *f, Lisp_Object 
contents, Lisp_Object header)
        }
       else
        {
-         text = L"";
+         text = (WCHAR *)L"";
        }
 
       if (NILP (header))
@@ -1465,6 +1461,8 @@ fill_in_menu (HMENU menu, widget_value *wv)
 /* Display help string for currently pointed to menu item. Not
    supported on NT 3.51 and earlier, as GetMenuItemInfo is not
    available. */
+void w32_menu_display_help (HWND, HMENU, UINT, UINT);
+
 void
 w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
 {
diff --git a/src/w32notify.c b/src/w32notify.c
index 54d9bcc..d4a113a 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -123,7 +123,6 @@ static Lisp_Object watch_list;
 static void
 send_notifications (struct notifications_set *ns)
 {
-  int done = 0;
   struct frame *f = SELECTED_FRAME ();
 
   /* We add the current notification set to the linked list.  Use the
@@ -153,8 +152,10 @@ send_notifications (struct notifications_set *ns)
   /* When we are running in batch mode, there's no one to send a
      message, so we just signal the data is available and hope
      sys_select will be called soon and will read the data.  */
+#if 0
   else if (FRAME_INITIAL_P (f) && noninteractive)
     ;
+#endif
 }
 
 /* An APC routine to cancel outstanding directory watch.  Invoked by
@@ -162,6 +163,8 @@ send_notifications (struct notifications_set *ns)
    thread that issued the ReadDirectoryChangesW call can call CancelIo
    to cancel that.  (CancelIoEx is only available since Vista, so we
    cannot use it on XP.)  */
+VOID CALLBACK watch_end (ULONG_PTR);
+
 VOID CALLBACK
 watch_end (ULONG_PTR arg)
 {
@@ -175,6 +178,8 @@ watch_end (ULONG_PTR arg)
    read by ReadDirectoryChangesW.  Called by the OS when the thread
    which issued the asynchronous ReadDirectoryChangesW call is in the
    "alertable state", i.e. waiting inside SleepEx call.  */
+VOID CALLBACK watch_completion (DWORD, DWORD, OVERLAPPED *);
+
 VOID CALLBACK
 watch_completion (DWORD status, DWORD bytes_ret, OVERLAPPED *io_info)
 {
diff --git a/src/w32proc.c b/src/w32proc.c
index 4a6f786..11a121f 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -45,11 +45,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #undef kill
 
 #include <windows.h>
-#if defined(__GNUC__) && !defined(__MINGW64__)
-/* This definition is missing from mingw.org headers, but not MinGW64
-   headers. */
-extern BOOL WINAPI IsValidLocale (LCID, DWORD);
-#endif
 
 #ifdef HAVE_LANGINFO_CODESET
 #include <nl_types.h>
@@ -70,6 +65,10 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
            + ((DWORD_PTR)(var) - (section)->VirtualAddress)            \
            + (filedata).file_base))
 
+extern BOOL g_b_init_compare_string_w;
+int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
+               struct timespec *, void *);
+
 /* Signal handlers...SIG_DFL == 0 so this is initialized correctly.  */
 static signal_handler sig_handlers[NSIG];
 
@@ -1728,7 +1727,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
      are not expanded if we run the program directly without a shell.
      Some extra whitespace characters need quoting in Cygwin/MSYS programs,
      so this list is conditionally modified below.  */
-  char *sepchars = " \t*?";
+  const char *sepchars = " \t*?";
   /* This is for native w32 apps; modified below for Cygwin/MSUS apps.  */
   char escape_char = '\\';
   char cmdname_a[MAX_PATH];
@@ -2815,7 +2814,6 @@ set_process_dir (char * dir)
 /* From w32.c */
 extern HANDLE winsock_lib;
 extern BOOL term_winsock (void);
-extern BOOL init_winsock (int load_now);
 
 DEFUN ("w32-has-winsock", Fw32_has_winsock, Sw32_has_winsock, 0, 1, 0,
        doc: /* Test for presence of the Windows socket library `winsock'.
@@ -3522,7 +3520,6 @@ w32_compare_strings (const char *s1, const char *s2, char 
*locname,
   LCID lcid = GetThreadLocale ();
   wchar_t *string1_w, *string2_w;
   int val, needed;
-  extern BOOL g_b_init_compare_string_w;
   static CompareStringW_Proc pCompareStringW;
   DWORD flags = 0;
 
diff --git a/src/w32reg.c b/src/w32reg.c
index a873818..25d6bb8 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -56,9 +56,9 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 */
 
 static char *
-w32_get_rdb_resource (char *rdb, const char *resource)
+w32_get_rdb_resource (const char *rdb, const char *resource)
 {
-  char *value = rdb;
+  char *value = (char *)rdb;
   int len = strlen (resource);
 
   while (*value)
diff --git a/src/w32select.c b/src/w32select.c
index a29f5f6..a38a42c 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -76,6 +76,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "w32common.h" /* os_subtype */
 #include "w32term.h"   /* for all of the w32 includes */
+#include "w32select.h"
 #include "keyboard.h"  /* for waiting_for_input */
 #include "blockinput.h"
 #include "coding.h"
diff --git a/src/w32term.c b/src/w32term.c
index 14a43c1..c16c8f4 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -83,8 +83,6 @@ static int any_help_event_p;
 
 extern unsigned int msh_mousewheel;
 
-extern void free_frame_menubar (struct frame *);
-
 extern int w32_codepage_for_font (char *fontname);
 extern Cursor w32_load_cursor (LPCTSTR name);
 
@@ -178,9 +176,7 @@ static void w32_define_cursor (Window, Cursor);
 
 void x_lower_frame (struct frame *);
 void x_scroll_bar_clear (struct frame *);
-void x_wm_set_size_hint (struct frame *, long, bool);
 void x_raise_frame (struct frame *);
-void x_set_window_size (struct frame *, bool, int, int, bool);
 void x_wm_set_window_state (struct frame *, int);
 void x_wm_set_icon_pixmap (struct frame *, int);
 static void w32_initialize (void);
@@ -248,7 +244,7 @@ record_event (char *locus, int type)
 #endif /* 0 */
 
 
-void
+static void
 XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
           XGCValues *xgcv)
 {
@@ -270,12 +266,14 @@ XCreateGC (void *ignore, Window window, unsigned long 
mask, XGCValues *xgcv)
   return gc;
 }
 
-void
+#if 0  /* unused for now, see x_draw_image_glyph_string below */
+static void
 XGetGCValues (void *ignore, XGCValues *gc,
              unsigned long mask, XGCValues *xgcv)
 {
   XChangeGC (ignore, xgcv, mask, gc);
 }
+#endif
 
 static void
 w32_set_clip_rectangle (HDC hdc, RECT *rect)
@@ -321,7 +319,7 @@ w32_restore_glyph_string_clip (struct glyph_string *s)
 
 */
 
-void
+static void
 w32_draw_underwave (struct glyph_string *s, COLORREF color)
 {
   int wave_height = 3, wave_length = 2;
@@ -384,7 +382,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color)
 }
 
 /* Draw a hollow rectangle at the specified position.  */
-void
+static void
 w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
                     int width, int height)
 {
@@ -2579,7 +2577,7 @@ x_draw_glyph_string (struct glyph_string *s)
 
 /* Shift display to make room for inserted glyphs.   */
 
-void
+static void
 w32_shift_glyphs_for_insert (struct frame *f, int x, int y,
                             int width, int height, int shift_by)
 {
@@ -2876,13 +2874,15 @@ w32_detect_focus_change (struct w32_display_info 
*dpyinfo, W32Msg *event,
 }
 
 
+#if 0  /* unused */
 /* Handle an event saying the mouse has moved out of an Emacs frame.  */
 
-void
+static void
 x_mouse_leave (struct w32_display_info *dpyinfo)
 {
   x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame);
 }
+#endif
 
 /* The focus has changed, or we have redirected a frame's focus to
    another frame (this happens when a frame uses a surrogate
@@ -4550,6 +4550,8 @@ static char dbcs_lead = 0;
    recursively with different messages by the system.
 */
 
+extern void menubar_selection_callback (struct frame *, void *);
+
 static int
 w32_read_socket (struct terminal *terminal,
                 struct input_event *hold_quit)
@@ -5281,8 +5283,6 @@ w32_read_socket (struct terminal *terminal,
 
          if (f)
            {
-             extern void menubar_selection_callback
-               (struct frame *f, void * client_data);
              menubar_selection_callback (f, (void *)msg.msg.wParam);
            }
 
@@ -5899,7 +5899,7 @@ xim_close_dpy (dpyinfo)
 /* Calculate the absolute position in frame F
    from its current recorded position values and gravity.  */
 
-void
+static void
 x_calc_absolute_position (struct frame *f)
 {
   int flags = f->size_hint_flags;
@@ -6575,7 +6575,7 @@ x_free_frame_resources (struct frame *f)
 
 
 /* Destroy the window of frame F.  */
-void
+static void
 x_destroy_window (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
diff --git a/src/w32term.h b/src/w32term.h
index 8585c81..e134da5 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -230,25 +230,14 @@ extern struct frame *x_window_to_frame (struct 
w32_display_info *, HWND);
 
 struct w32_display_info *x_display_info_for_name (Lisp_Object);
 
-Lisp_Object display_x_get_resource (struct w32_display_info *,
-                                    Lisp_Object, Lisp_Object,
-                                    Lisp_Object, Lisp_Object);
-
 /* also defined in xterm.h XXX: factor out to common header */
 
 extern struct w32_display_info *w32_term_init (Lisp_Object,
                                               char *, char *);
 extern int w32_defined_color (struct frame *f, const char *color,
                               XColor *color_def, bool alloc_p);
-extern void x_set_window_size (struct frame *f, bool change_gravity,
-                              int width, int height, bool pixelwise);
 extern int x_display_pixel_height (struct w32_display_info *);
 extern int x_display_pixel_width (struct w32_display_info *);
-extern Lisp_Object x_get_focus_frame (struct frame *);
-extern void x_make_frame_visible (struct frame *f);
-extern void x_make_frame_invisible (struct frame *f);
-extern void x_iconify_frame (struct frame *f);
-extern void x_set_frame_alpha (struct frame *f);
 extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 extern void x_set_tool_bar_lines (struct frame *f,
                                   Lisp_Object value,
@@ -256,19 +245,12 @@ extern void x_set_tool_bar_lines (struct frame *f,
 extern void x_set_internal_border_width (struct frame *f,
                                         Lisp_Object value,
                                         Lisp_Object oldval);
-extern void x_activate_menubar (struct frame *);
-extern bool x_bitmap_icon (struct frame *, Lisp_Object);
 extern void initialize_frame_menubar (struct frame *);
-extern void x_free_frame_resources (struct frame *);
-extern void x_real_positions (struct frame *, int *, int *);
 
 /* w32inevt.c */
 extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId);
 extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key);
 
-
-extern Lisp_Object x_get_focus_frame (struct frame *);
-
 /* w32console.c */
 extern void w32con_hide_cursor (void);
 extern void w32con_show_cursor (void);
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index ddca5f5..5f91b50 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -50,7 +50,7 @@ static int CALLBACK ALIGN_STACK 
add_opentype_font_name_to_list (ENUMLOGFONTEX *,
                                                                NEWTEXTMETRICEX 
*,
                                                                DWORD, LPARAM);
 /* Used by uniscribe_otf_capability.  */
-static Lisp_Object otf_features (HDC context, char *table);
+static Lisp_Object otf_features (HDC context, const char *table);
 
 static int
 memq_no_quit (Lisp_Object elt, Lisp_Object list)
@@ -1042,7 +1042,7 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
 }
 
 static Lisp_Object
-otf_features (HDC context, char *table)
+otf_features (HDC context, const char *table)
 {
   Lisp_Object script_list = Qnil;
   unsigned short scriptlist_table, n_scripts, feature_table;
@@ -1166,6 +1166,8 @@ struct font_driver uniscribe_font_driver =
 
 /* Note that this should be called at every startup, not just when dumping,
    as it needs to test for the existence of the Uniscribe library.  */
+void syms_of_w32uniscribe (void);
+
 void
 syms_of_w32uniscribe (void)
 {
diff --git a/src/xfaces.c b/src/xfaces.c
index c42e553..93d1c47 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -221,7 +221,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include TERM_HEADER
 #include "fontset.h"
 #ifdef HAVE_NTGUI
-#define x_display_info w32_display_info
 #define GCGraphicsExposures 0
 #endif /* HAVE_NTGUI */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]