Mercurial > jwe > octave
changeset 24118:f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
* sighandlers.cc (w32_interrupt_manager::do_jump_to_enclosing_context): Use
reinterpret_cast to silence compiler warning from -Wold-style-cast.
* welcome-wizard.cc (welcome_wizard::welcome_wizard): Likewise.
* oct-procbuf.cc (octave_procbuf_list): Only define on systems that use it to
silence compiler warning from -Wunused-variable.
* sysdep.cc (w32_shell_execute): Delete empty unused function to silence several
compiler warnings. (raw_mode): Use octave_unused_parameter to silence compiler
warnings from -Wunused-parameter on certain systems.
* cdisplay.c (octave_get_display_info): Use octave_unused_parameter to silence
compiler warning from -Wunused-parameter on certain systems.
* oct-group.cc (octave::sys::group::getgrgid, octave::sys::group::getgrnam,
octave::sys::group::group): Likewise.
* oct-passwd.cc (octave::sys::password::getpwuid,
octave::sys::password::getpwnam, octave::sys::password::password): Likewise.
* signal-wrappers.c (octave_kill_wrapper, block_or_unblock_signal): Likewise.
* wait-for-input.c (octave_wait_for_input): Likewise.
* unistd-wrappers.c (prepare_spawn): Add const-qualifier on argument to silence
compiler warning from -Wdiscarded-qualifiers.
* stat-wrappers.c: Use pragma to disable -Wunused-parameter warnings for wrapper
functions around macros that may discard their arguments on certain systems.
* wait-wrappers.c Use pragma to disable -Wunused-parameter warnings for wrapper
functions around macros that may discard their arguments on certain systems.
Reorder functions to group related wrappers.
(octave_waitpid_wrapper): Use octave_unused_parameter to silence compiler
warning from -Wunused-parameter on certain systems.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sun, 01 Oct 2017 14:52:33 -0700 |
parents | 01df6b5209f4 |
children | 3cdd0705745b |
files | libgui/src/welcome-wizard.cc libinterp/corefcn/cdisplay.c libinterp/corefcn/oct-procbuf.cc libinterp/corefcn/sighandlers.cc libinterp/corefcn/sysdep.cc liboctave/system/oct-group.cc liboctave/system/oct-passwd.cc liboctave/wrappers/signal-wrappers.c liboctave/wrappers/stat-wrappers.c liboctave/wrappers/unistd-wrappers.c liboctave/wrappers/wait-for-input.c liboctave/wrappers/wait-wrappers.c |
diffstat | 12 files changed, 92 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/welcome-wizard.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/libgui/src/welcome-wizard.cc Sun Oct 01 14:52:33 2017 -0700 @@ -68,7 +68,7 @@ #if defined (OCTAVE_USE_WINDOWS_API) // HACK to forceshow of dialog if started minimized - ShowWindow ((HWND)winId (), SW_SHOWNORMAL); + ShowWindow (reinterpret_cast<HWND> (winId ()), SW_SHOWNORMAL); #endif }
--- a/libinterp/corefcn/cdisplay.c Thu Sep 28 21:08:51 2017 -0700 +++ b/libinterp/corefcn/cdisplay.c Sun Oct 01 14:52:33 2017 -0700 @@ -57,6 +57,8 @@ #if defined (OCTAVE_USE_WINDOWS_API) + octave_unused_parameter (dpy_name); + HDC hdc = GetDC (0); if (hdc) @@ -79,6 +81,8 @@ #elif defined (HAVE_FRAMEWORK_CARBON) + octave_unused_parameter (dpy_name); + CGDirectDisplayID display = CGMainDisplayID (); if (display) @@ -163,6 +167,7 @@ #else + octave_unused_parameter (dpy_name); octave_unused_parameter (ht); octave_unused_parameter (wd); octave_unused_parameter (dp);
--- a/libinterp/corefcn/oct-procbuf.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/libinterp/corefcn/oct-procbuf.cc Sun Oct 01 14:52:33 2017 -0700 @@ -59,8 +59,13 @@ // This class is based on the procbuf class from libg++, written by // Per Bothner, Copyright (C) 1993 Free Software Foundation. +#if (! (defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)) \ + && defined (HAVE_UNISTD_H)) + static octave_procbuf *octave_procbuf_list = nullptr; +#endif + #if ! defined (BUFSIZ) # define BUFSIZ 1024 #endif
--- a/libinterp/corefcn/sighandlers.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/libinterp/corefcn/sighandlers.cc Sun Oct 01 14:52:33 2017 -0700 @@ -157,9 +157,9 @@ GetThreadContext (thread, &threadContext); #if (defined (__MINGW64__) || defined (_WIN64)) - threadContext.Rip = (DWORD64) jump_to_enclosing_context_sync; + threadContext.Rip = reinterpret_cast<DWORD64> (jump_to_enclosing_context_sync); #else - threadContext.Eip = (DWORD) jump_to_enclosing_context_sync; + threadContext.Eip = reinterpret_cast<DWORD> (jump_to_enclosing_context_sync); #endif SetThreadContext (thread, &threadContext);
--- a/libinterp/corefcn/sysdep.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/libinterp/corefcn/sysdep.cc Sun Oct 01 14:52:33 2017 -0700 @@ -164,10 +164,6 @@ octave::command_editor::prefer_env_winsize (true); } -static bool -w32_shell_execute (const std::string& file) -{ } - #endif // Set app id if we have the SetCurrentProcessExplicitAppUserModelID @@ -461,6 +457,8 @@ } #elif defined (HAVE_SGTTY_H) { + octave_unused_parameter (wait); + struct sgttyb s; static struct sgttyb save_term; @@ -492,6 +490,9 @@ ioctl (tty_fd, TIOCSETN, &s); } #else + + octave_unused_parameter (wait); + warn_disabled_feature ("", "raw mode console I/O"); // Make sure the current mode doesn't toggle.
--- a/liboctave/system/oct-group.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/system/oct-group.cc Sun Oct 01 14:52:33 2017 -0700 @@ -117,6 +117,8 @@ msg = ""; return group (::getgrgid (gid), msg); #else + octave_unused_parameter (gid); + msg = NOT_SUPPORTED ("getgruid"); return group (); #endif @@ -136,6 +138,8 @@ msg = ""; return group (::getgrnam (nm.c_str ()), msg); #else + octave_unused_parameter (nm); + msg = NOT_SUPPORTED ("getgrnam"); return group (); #endif @@ -221,6 +225,8 @@ valid = true; } #else + octave_unused_parameter (p); + msg = NOT_SUPPORTED ("group functions"); #endif }
--- a/liboctave/system/oct-passwd.cc Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/system/oct-passwd.cc Sun Oct 01 14:52:33 2017 -0700 @@ -143,6 +143,8 @@ msg = ""; return password (::getpwuid (uid), msg); #else + octave_unused_parameter (uid); + msg = NOT_SUPPORTED ("getpwuid"); return password (); #endif @@ -162,6 +164,8 @@ msg = ""; return password (::getpwnam (nm.c_str ()), msg); #else + octave_unused_parameter (nm); + msg = NOT_SUPPORTED ("getpwnam"); return password (); #endif @@ -229,6 +233,8 @@ valid = true; } #else + octave_unused_parameter (p); + msg = NOT_SUPPORTED ("password functions"); #endif }
--- a/liboctave/wrappers/signal-wrappers.c Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/wrappers/signal-wrappers.c Sun Oct 01 14:52:33 2017 -0700 @@ -48,6 +48,10 @@ #if defined (HAVE_KILL) return kill (pid, signum); #else + + octave_unused_parameter (pid); + octave_unused_parameter (signum); + return -1; #endif } @@ -451,6 +455,11 @@ sigaddset (&signal_mask, sig); pthread_sigmask (how, &signal_mask, 0); +#else + + octave_unused_parameter (how); + octave_unused_parameter (sig); + #endif }
--- a/liboctave/wrappers/stat-wrappers.c Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/wrappers/stat-wrappers.c Sun Oct 01 14:52:33 2017 -0700 @@ -142,6 +142,14 @@ return status; } +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) +// Disable the unused parameter warning for the following wrapper functions. +// The <sys/stat.h> header provided by gnulib may define some of the S_IS* +// macros to expand to a constant and ignore the parameter. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + bool octave_is_blk_wrapper (mode_t mode) { @@ -212,6 +220,11 @@ #endif } +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) +// Restore prevailing warning state for remainder of the file. +#pragma GCC diagnostic pop +#endif + bool octave_have_struct_stat_st_rdev (void) {
--- a/liboctave/wrappers/unistd-wrappers.c Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/wrappers/unistd-wrappers.c Sun Oct 01 14:52:33 2017 -0700 @@ -141,7 +141,7 @@ " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" static char ** -prepare_spawn (char **argv) +prepare_spawn (char *const *argv) { size_t argc; char **new_argv;
--- a/liboctave/wrappers/wait-for-input.c Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/wrappers/wait-for-input.c Sun Oct 01 14:52:33 2017 -0700 @@ -51,6 +51,8 @@ retval = select (FD_SETSIZE, &set, 0, 0, 0); } #else + octave_unused_parameter (fid); + retval = 1; #endif
--- a/liboctave/wrappers/wait-wrappers.c Thu Sep 28 21:08:51 2017 -0700 +++ b/liboctave/wrappers/wait-wrappers.c Sun Oct 01 14:52:33 2017 -0700 @@ -46,10 +46,18 @@ # define WUNTRACED 0 #endif +#if ! defined (WIFCONTINUED) +# define WIFCONTINUED(x) false +#endif + pid_t octave_waitpid_wrapper (pid_t pid, int *statusp, int options) { #if defined (__WIN32__) && ! defined (__CYGWIN__) + + octave_unused_parameter (pid); + octave_unused_parameter (options); + // gnulib's waitpid replacement currently uses _cwait, which // apparently only works with console applications. *statusp = 0; @@ -66,14 +74,36 @@ } int +octave_wnohang_wrapper (void) +{ + return WNOHANG; +} + +int +octave_wuntraced_wrapper (void) +{ + return WUNTRACED; +} + +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) +// Disable the unused parameter warning for the following wrapper functions. +// The <sys/wait.h> header provided by gnulib may define some of the W* +// macros to expand to a constant and ignore the parameter. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +int octave_wcoredump_wrapper (int status) { return WCOREDUMP (status); } -#if ! defined (WIFCONTINUED) -# define WIFCONTINUED(x) false -#endif +int +octave_wexitstatus_wrapper (int status) +{ + return WEXITSTATUS (status); +} bool octave_wifcontinued_wrapper (int status) @@ -100,18 +130,6 @@ } int -octave_wexitstatus_wrapper (int status) -{ - return WEXITSTATUS (status); -} - -int -octave_wnohang_wrapper (void) -{ - return WNOHANG; -} - -int octave_wstopsig_wrapper (int status) { return WSTOPSIG (status); @@ -123,8 +141,7 @@ return WTERMSIG (status); } -int -octave_wuntraced_wrapper (void) -{ - return WUNTRACED; -} +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) +// Restore prevailing warning state for remainder of the file. +#pragma GCC diagnostic pop +#endif