build: add -Wstrict-prototypes

Fixes: https://github.com/libuv/libuv/pull/1320
PR-URL: https://github.com/libuv/libuv/pull/1326
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Jameson Nash 2017-04-27 10:23:46 -04:00 committed by Santiago Gimeno
parent 51f3f56f34
commit fd39cec4b8
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE
15 changed files with 33 additions and 29 deletions

View File

@ -17,6 +17,7 @@ CC ?= gcc
CFLAGS += -Wall \ CFLAGS += -Wall \
-Wextra \ -Wextra \
-Wno-unused-parameter \ -Wno-unused-parameter \
-Wstrict-prototypes \
-Iinclude \ -Iinclude \
-Isrc \ -Isrc \
-Isrc/win \ -Isrc/win \

View File

@ -180,6 +180,7 @@
'-Wendif-labels', '-Wendif-labels',
'-W', '-W',
'-Wno-unused-parameter', '-Wno-unused-parameter',
'-Wstrict-prototypes',
], ],
}, },
'conditions': [ 'conditions': [

View File

@ -33,6 +33,7 @@ CC_CHECK_CFLAGS_APPEND([-std=gnu89])
CC_CHECK_CFLAGS_APPEND([-Wall]) CC_CHECK_CFLAGS_APPEND([-Wall])
CC_CHECK_CFLAGS_APPEND([-Wextra]) CC_CHECK_CFLAGS_APPEND([-Wextra])
CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter]) CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12. # AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR. # autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR.

View File

@ -226,7 +226,7 @@ void uv__async_stop(uv_loop_t* loop) {
} }
static int uv__async_eventfd() { static int uv__async_eventfd(void) {
#if defined(__linux__) #if defined(__linux__)
static int no_eventfd2; static int no_eventfd2;
static int no_eventfd; static int no_eventfd;

View File

@ -83,7 +83,7 @@ static int uv__loops_capacity;
#define UV__LOOPS_CHUNK_SIZE 8 #define UV__LOOPS_CHUNK_SIZE 8
static uv_mutex_t uv__loops_lock; static uv_mutex_t uv__loops_lock;
static void uv__loops_init() { static void uv__loops_init(void) {
uv_mutex_init(&uv__loops_lock); uv_mutex_init(&uv__loops_lock);
} }
@ -158,7 +158,7 @@ loop_removed:
uv_mutex_unlock(&uv__loops_lock); uv_mutex_unlock(&uv__loops_lock);
} }
void uv__wake_all_loops() { void uv__wake_all_loops(void) {
int i; int i;
uv_loop_t* loop; uv_loop_t* loop;

View File

@ -2,9 +2,9 @@
#include "internal.h" #include "internal.h"
#include "winapi.h" #include "winapi.h"
static void uv__register_system_resume_callback(); static void uv__register_system_resume_callback(void);
void uv__init_detect_system_wakeup() { void uv__init_detect_system_wakeup(void) {
/* Try registering system power event callback. This is the cleanest /* Try registering system power event callback. This is the cleanest
* method, but it will only work on Win8 and above. * method, but it will only work on Win8 and above.
*/ */
@ -20,7 +20,7 @@ static ULONG CALLBACK uv__system_resume_callback(PVOID Context,
return 0; return 0;
} }
static void uv__register_system_resume_callback() { static void uv__register_system_resume_callback(void) {
_DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient; _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient;
_HPOWERNOTIFY registration_handle; _HPOWERNOTIFY registration_handle;

View File

@ -114,7 +114,7 @@ const WCHAR UNC_PATH_PREFIX[] = L"\\\\?\\UNC\\";
const WCHAR UNC_PATH_PREFIX_LEN = 8; const WCHAR UNC_PATH_PREFIX_LEN = 8;
void uv_fs_init() { void uv_fs_init(void) {
_fmode = _O_BINARY; _fmode = _O_BINARY;
} }

View File

@ -206,7 +206,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle);
/* /*
* TTY * TTY
*/ */
void uv_console_init(); void uv_console_init(void);
int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb,
uv_read_cb read_cb); uv_read_cb read_cb);
@ -259,7 +259,7 @@ void uv_prepare_invoke(uv_loop_t* loop);
void uv_check_invoke(uv_loop_t* loop); void uv_check_invoke(uv_loop_t* loop);
void uv_idle_invoke(uv_loop_t* loop); void uv_idle_invoke(uv_loop_t* loop);
void uv__once_init(); void uv__once_init(void);
/* /*
@ -275,7 +275,7 @@ void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle,
/* /*
* Signal watcher * Signal watcher
*/ */
void uv_signals_init(); void uv_signals_init(void);
int uv__signal_dispatch(int signum); int uv__signal_dispatch(int signum);
void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle); void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle);
@ -302,7 +302,7 @@ int uv_translate_sys_error(int sys_errno);
/* /*
* FS * FS
*/ */
void uv_fs_init(); void uv_fs_init(void);
/* /*
@ -323,11 +323,11 @@ void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle);
/* /*
* Utilities. * Utilities.
*/ */
void uv__util_init(); void uv__util_init(void);
uint64_t uv__hrtime(double scale); uint64_t uv__hrtime(double scale);
int uv_parent_pid(); int uv_parent_pid(void);
int uv_current_pid(); int uv_current_pid(void);
__declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall); __declspec(noreturn) void uv_fatal_error(const int errorno, const char* syscall);
int uv__getpwuid_r(uv_passwd_t* pwd); int uv__getpwuid_r(uv_passwd_t* pwd);
int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8); int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8);
@ -350,13 +350,13 @@ HANDLE uv__stdio_handle(BYTE* buffer, int fd);
/* /*
* Winapi and ntapi utility functions * Winapi and ntapi utility functions
*/ */
void uv_winapi_init(); void uv_winapi_init(void);
/* /*
* Winsock utility functions * Winsock utility functions
*/ */
void uv_winsock_init(); void uv_winsock_init(void);
int uv_ntstatus_to_winsock_error(NTSTATUS status); int uv_ntstatus_to_winsock_error(NTSTATUS status);
@ -385,11 +385,11 @@ extern struct sockaddr_in6 uv_addr_ip6_any_;
/* /*
* Wake all loops with fake message * Wake all loops with fake message
*/ */
void uv__wake_all_loops(); void uv__wake_all_loops(void);
/* /*
* Init system wake-up detection * Init system wake-up detection
*/ */
void uv__init_detect_system_wakeup(); void uv__init_detect_system_wakeup(void);
#endif /* UV_WIN_INTERNAL_H_ */ #endif /* UV_WIN_INTERNAL_H_ */

View File

@ -61,13 +61,13 @@ static void uv__init_overlapped_dummy(void) {
} }
static OVERLAPPED* uv__get_overlapped_dummy() { static OVERLAPPED* uv__get_overlapped_dummy(void) {
uv_once(&overlapped_dummy_init_guard_, uv__init_overlapped_dummy); uv_once(&overlapped_dummy_init_guard_, uv__init_overlapped_dummy);
return &overlapped_dummy_; return &overlapped_dummy_;
} }
static AFD_POLL_INFO* uv__get_afd_poll_info_dummy() { static AFD_POLL_INFO* uv__get_afd_poll_info_dummy(void) {
return &afd_poll_info_dummy_; return &afd_poll_info_dummy_;
} }

View File

@ -39,7 +39,7 @@ int uv__signal_start(uv_signal_t* handle,
int signum, int signum,
int oneshot); int oneshot);
void uv_signals_init() { void uv_signals_init(void) {
InitializeCriticalSection(&uv__signal_lock); InitializeCriticalSection(&uv__signal_lock);
if (!SetConsoleCtrlHandler(uv__signal_control_handler, TRUE)) if (!SetConsoleCtrlHandler(uv__signal_control_handler, TRUE))
abort(); abort();

View File

@ -138,7 +138,7 @@ typedef enum {
static uv_vtermstate_t uv__vterm_state = UV_UNCHECKED; static uv_vtermstate_t uv__vterm_state = UV_UNCHECKED;
static void uv__determine_vterm_state(HANDLE handle); static void uv__determine_vterm_state(HANDLE handle);
void uv_console_init() { void uv_console_init(void) {
if (uv_sem_init(&uv_tty_output_lock, 1)) if (uv_sem_init(&uv_tty_output_lock, 1))
abort(); abort();
} }

View File

@ -77,7 +77,7 @@ static double hrtime_interval_ = 0;
/* /*
* One-time initialization code for functionality defined in util.c. * One-time initialization code for functionality defined in util.c.
*/ */
void uv__util_init() { void uv__util_init(void) {
LARGE_INTEGER perf_frequency; LARGE_INTEGER perf_frequency;
/* Initialize process title access mutex. */ /* Initialize process title access mutex. */
@ -323,7 +323,7 @@ uint64_t uv_get_total_memory(void) {
} }
int uv_parent_pid() { int uv_parent_pid(void) {
int parent_pid = -1; int parent_pid = -1;
HANDLE handle; HANDLE handle;
PROCESSENTRY32 pe; PROCESSENTRY32 pe;
@ -346,7 +346,7 @@ int uv_parent_pid() {
} }
int uv_current_pid() { int uv_current_pid(void) {
if (current_pid == 0) { if (current_pid == 0) {
current_pid = GetCurrentProcessId(); current_pid = GetCurrentProcessId();
} }
@ -408,7 +408,7 @@ done:
} }
static int uv__get_process_title() { static int uv__get_process_title(void) {
WCHAR title_w[MAX_TITLE_LENGTH]; WCHAR title_w[MAX_TITLE_LENGTH];
if (!GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR))) { if (!GetConsoleTitleW(title_w, sizeof(title_w) / sizeof(WCHAR))) {

View File

@ -53,7 +53,7 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
void uv_winapi_init() { void uv_winapi_init(void) {
HMODULE ntdll_module; HMODULE ntdll_module;
HMODULE kernel32_module; HMODULE kernel32_module;
HMODULE powrprof_module; HMODULE powrprof_module;

View File

@ -80,7 +80,7 @@ static int error_means_no_support(DWORD error) {
} }
void uv_winsock_init() { void uv_winsock_init(void) {
WSADATA wsa_data; WSADATA wsa_data;
int errorno; int errorno;
SOCKET dummy; SOCKET dummy;

3
uv.gyp
View File

@ -36,7 +36,7 @@
], ],
'xcode_settings': { 'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'WARNING_CFLAGS': [ '-Wall', '-Wextra', '-Wno-unused-parameter' ], 'WARNING_CFLAGS': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wstrict-prototypes' ],
'OTHER_CFLAGS': [ '-g', '--std=gnu89', '-pedantic' ], 'OTHER_CFLAGS': [ '-g', '--std=gnu89', '-pedantic' ],
} }
}, },
@ -210,6 +210,7 @@
'-Wall', '-Wall',
'-Wextra', '-Wextra',
'-Wno-unused-parameter', '-Wno-unused-parameter',
'-Wstrict-prototypes',
], ],
}], }],
[ 'OS in "mac ios"', { [ 'OS in "mac ios"', {