aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorEli Zaretskii2016-05-21 20:06:33 +0300
committerEli Zaretskii2016-05-21 20:06:33 +0300
commitcb5af79249c2c9e21405e6237db11935b50dd1c5 (patch)
tree1f2abf3854f399b16861afaeca9648554b906421 /lib-src
parent99848b37d2c3e14c0af45fc6da437a806aa58a80 (diff)
downloademacs-cb5af79249c2c9e21405e6237db11935b50dd1c5.tar.gz
emacs-cb5af79249c2c9e21405e6237db11935b50dd1c5.zip
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c32
-rw-r--r--lib-src/etags.c1
-rw-r--r--lib-src/ntlib.c8
-rw-r--r--lib-src/ntlib.h3
4 files changed, 31 insertions, 13 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index dd66d34da70..aab9c4b62f5 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/>. */
39# define CLOSE_SOCKET closesocket 39# define CLOSE_SOCKET closesocket
40# define INITIALIZE() (initialize_sockets ()) 40# define INITIALIZE() (initialize_sockets ())
41 41
42char *w32_getenv (char *); 42char *w32_getenv (const char *);
43#define egetenv(VAR) w32_getenv(VAR) 43#define egetenv(VAR) w32_getenv(VAR)
44 44
45#else /* !WINDOWSNT */ 45#else /* !WINDOWSNT */
@@ -254,6 +254,7 @@ get_current_dir_name (void)
254#ifdef WINDOWSNT 254#ifdef WINDOWSNT
255 255
256/* Like strdup but get a fatal error if memory is exhausted. */ 256/* Like strdup but get a fatal error if memory is exhausted. */
257char *xstrdup (const char *);
257 258
258char * 259char *
259xstrdup (const char *s) 260xstrdup (const char *s)
@@ -269,11 +270,13 @@ xstrdup (const char *s)
269 270
270#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 271#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
271 272
273char *w32_get_resource (HKEY, const char *, LPDWORD);
274
272/* Retrieve an environment variable from the Emacs subkeys of the registry. 275/* Retrieve an environment variable from the Emacs subkeys of the registry.
273 Return NULL if the variable was not found, or it was empty. 276 Return NULL if the variable was not found, or it was empty.
274 This code is based on w32_get_resource (w32.c). */ 277 This code is based on w32_get_resource (w32.c). */
275char * 278char *
276w32_get_resource (HKEY predefined, char *key, LPDWORD type) 279w32_get_resource (HKEY predefined, const char *key, LPDWORD type)
277{ 280{
278 HKEY hrootkey = NULL; 281 HKEY hrootkey = NULL;
279 char *result = NULL; 282 char *result = NULL;
@@ -285,7 +288,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
285 { 288 {
286 result = (char *) xmalloc (cbData); 289 result = (char *) xmalloc (cbData);
287 290
288 if ((RegQueryValueEx (hrootkey, key, NULL, type, result, &cbData) != ERROR_SUCCESS) 291 if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, &cbData) != ERROR_SUCCESS)
289 || (*result == 0)) 292 || (*result == 0))
290 { 293 {
291 free (result); 294 free (result);
@@ -308,7 +311,7 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
308 environment variables in the registry if they don't appear in the 311 environment variables in the registry if they don't appear in the
309 environment. */ 312 environment. */
310char * 313char *
311w32_getenv (char *envvar) 314w32_getenv (const char *envvar)
312{ 315{
313 char *value; 316 char *value;
314 DWORD dwType; 317 DWORD dwType;
@@ -356,6 +359,7 @@ w32_getenv (char *envvar)
356 return NULL; 359 return NULL;
357} 360}
358 361
362int w32_window_app (void);
359 363
360int 364int
361w32_window_app (void) 365w32_window_app (void)
@@ -383,11 +387,13 @@ w32_window_app (void)
383 predictably bad results. By contrast, POSIX execvp passes the arguments 387 predictably bad results. By contrast, POSIX execvp passes the arguments
384 directly into the argv array of the child process. */ 388 directly into the argv array of the child process. */
385 389
390int w32_execvp (const char *, char **);
391extern int execvp (const char*, char **);
392
386int 393int
387w32_execvp (const char *path, char **argv) 394w32_execvp (const char *path, char **argv)
388{ 395{
389 int i; 396 int i;
390 extern int execvp (const char*, char **);
391 397
392 /* Required to allow a .BAT script as alternate editor. */ 398 /* Required to allow a .BAT script as alternate editor. */
393 argv[0] = (char *) alternate_editor; 399 argv[0] = (char *) alternate_editor;
@@ -407,7 +413,8 @@ w32_execvp (const char *path, char **argv)
407#define execvp w32_execvp 413#define execvp w32_execvp
408 414
409/* Emulation of ttyname for Windows. */ 415/* Emulation of ttyname for Windows. */
410char * 416const char *ttyname (int);
417const char *
411ttyname (int fd) 418ttyname (int fd)
412{ 419{
413 return "CONOUT$"; 420 return "CONOUT$";
@@ -852,6 +859,7 @@ file_name_absolute_p (const char *filename)
852 859
853#ifdef WINDOWSNT 860#ifdef WINDOWSNT
854/* Wrapper to make WSACleanup a cdecl, as required by atexit. */ 861/* Wrapper to make WSACleanup a cdecl, as required by atexit. */
862void __cdecl close_winsock (void);
855void __cdecl 863void __cdecl
856close_winsock (void) 864close_winsock (void)
857{ 865{
@@ -859,6 +867,7 @@ close_winsock (void)
859} 867}
860 868
861/* Initialize the WinSock2 library. */ 869/* Initialize the WinSock2 library. */
870void initialize_sockets (void);
862void 871void
863initialize_sockets (void) 872initialize_sockets (void)
864{ 873{
@@ -1380,11 +1389,13 @@ set_socket (int no_exit_if_error)
1380FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ 1389FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */
1381FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ 1390FARPROC get_wc; /* Pointer to RealGetWindowClassA. */
1382 1391
1392void w32_set_user_model_id (void);
1393
1383void 1394void
1384w32_set_user_model_id (void) 1395w32_set_user_model_id (void)
1385{ 1396{
1386 HMODULE shell; 1397 HMODULE shell;
1387 HRESULT (WINAPI * set_user_model) (wchar_t * id); 1398 HRESULT (WINAPI * set_user_model) (const wchar_t * id);
1388 1399
1389 /* On Windows 7 and later, we need to set the user model ID 1400 /* On Windows 7 and later, we need to set the user model ID
1390 to associate emacsclient launched files with Emacs frames 1401 to associate emacsclient launched files with Emacs frames
@@ -1407,6 +1418,8 @@ w32_set_user_model_id (void)
1407 } 1418 }
1408} 1419}
1409 1420
1421BOOL CALLBACK w32_find_emacs_process (HWND, LPARAM);
1422
1410BOOL CALLBACK 1423BOOL CALLBACK
1411w32_find_emacs_process (HWND hWnd, LPARAM lParam) 1424w32_find_emacs_process (HWND hWnd, LPARAM lParam)
1412{ 1425{
@@ -1433,6 +1446,7 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam)
1433 1446
1434/* Search for a window of class "Emacs" and owned by a process with 1447/* Search for a window of class "Emacs" and owned by a process with
1435 process id = emacs_pid. If found, allow it to grab the focus. */ 1448 process id = emacs_pid. If found, allow it to grab the focus. */
1449void w32_give_focus (void);
1436 1450
1437void 1451void
1438w32_give_focus (void) 1452w32_give_focus (void)
@@ -1526,7 +1540,7 @@ start_daemon_and_retry_set_socket (void)
1526 it is ready to accept client connections, by asserting an event 1540 it is ready to accept client connections, by asserting an event
1527 whose name is known to the daemon (defined by nt/inc/ms-w32.h). */ 1541 whose name is known to the daemon (defined by nt/inc/ms-w32.h). */
1528 1542
1529 if (!CreateProcess (NULL, "emacs --daemon", NULL, NULL, FALSE, 1543 if (!CreateProcess (NULL, (LPSTR)"emacs --daemon", NULL, NULL, FALSE,
1530 CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) 1544 CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
1531 { 1545 {
1532 char* msg = NULL; 1546 char* msg = NULL;
@@ -1548,7 +1562,7 @@ start_daemon_and_retry_set_socket (void)
1548 if ((wait_result = WaitForSingleObject (w32_daemon_event, INFINITE)) 1562 if ((wait_result = WaitForSingleObject (w32_daemon_event, INFINITE))
1549 != WAIT_OBJECT_0) 1563 != WAIT_OBJECT_0)
1550 { 1564 {
1551 char *msg = NULL; 1565 const char *msg = NULL;
1552 1566
1553 switch (wait_result) 1567 switch (wait_result)
1554 { 1568 {
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 570d2178547..1c85a792896 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";
112 112
113#ifdef WINDOWSNT 113#ifdef WINDOWSNT
114# include <direct.h> 114# include <direct.h>
115# define MAXPATHLEN _MAX_PATH
116# undef HAVE_NTGUI 115# undef HAVE_NTGUI
117# undef DOS_NT 116# undef DOS_NT
118# define DOS_NT 117# define DOS_NT
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 4b25796830e..2ace218f823 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/>. */
34 34
35#include "ntlib.h" 35#include "ntlib.h"
36 36
37char *sys_ctime (const time_t *);
38FILE *sys_fopen (const char *, const char *);
39int sys_chdir (const char *);
40int mkostemp (char *, int);
41int sys_rename (const char *, const char *);
42
37/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in 43/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
38 its system headers. */ 44 its system headers. */
39#ifndef _TIMEZONE_DEFINED 45#ifndef _TIMEZONE_DEFINED
@@ -44,6 +50,8 @@ struct timezone
44}; 50};
45#endif 51#endif
46 52
53void gettimeofday (struct timeval *, struct timezone *);
54
47#define MAXPATHLEN _MAX_PATH 55#define MAXPATHLEN _MAX_PATH
48 56
49/* Emulate sleep...we could have done this with a define, but that 57/* 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 b49da79f328..4849dccb032 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -34,15 +34,12 @@ char *getwd (char *dir);
34int getppid (void); 34int getppid (void);
35char * getlogin (void); 35char * getlogin (void);
36char * cuserid (char * s); 36char * cuserid (char * s);
37unsigned getuid (void);
38unsigned geteuid (void);
39unsigned getegid (void); 37unsigned getegid (void);
40unsigned getgid (void); 38unsigned getgid (void);
41int setuid (unsigned uid); 39int setuid (unsigned uid);
42int setregid (unsigned rgid, unsigned gid); 40int setregid (unsigned rgid, unsigned gid);
43char * getpass (const char * prompt); 41char * getpass (const char * prompt);
44int fchown (int fd, unsigned uid, unsigned gid); 42int fchown (int fd, unsigned uid, unsigned gid);
45int mkostemp (char * template, int flags);
46 43
47/* redirect or undo interceptions created by config.h */ 44/* redirect or undo interceptions created by config.h */
48#undef access 45#undef access