diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-29 02:05:31 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-29 02:05:31 +0000 |
commit | 32eb1c5336c83a75267c9773b323817e9992aa51 (patch) | |
tree | 992ed77be53d6362a20957fb6f8095fe0953f0ad | |
parent | d1e9d39661446283343f6a445ee9863959b0e0ae (diff) | |
download | chromium_src-32eb1c5336c83a75267c9773b323817e9992aa51.zip chromium_src-32eb1c5336c83a75267c9773b323817e9992aa51.tar.gz chromium_src-32eb1c5336c83a75267c9773b323817e9992aa51.tar.bz2 |
Make PPAPI headers compilable with -Wstrict-prototypes
This changes the PPAPI headers to use "foo(void)" rather than "foo()"
in function prototypes and definitions.
In C (but not C++), "foo()" declares a function with unspecified
arguments, which allows foo to be called with excess arguments or
implemented with excess arguments. Using "foo(void)" is more correct
and will prevent such mistakes. GCC's -Wstrict-prototypes warning
requires using "foo(void)", and we'd like to turn this warning on for
NaCl C code.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3114
TEST= rerun ppapi/generators/generator.py + compile
Review URL: https://codereview.chromium.org/11419192
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170120 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/c/dev/ppb_testing_dev.h | 10 | ||||
-rw-r--r-- | ppapi/c/ppb_core.h | 8 | ||||
-rw-r--r-- | ppapi/c/ppb_image_data.h | 4 | ||||
-rw-r--r-- | ppapi/c/ppb_message_loop.h | 6 | ||||
-rw-r--r-- | ppapi/c/ppp.h | 4 | ||||
-rw-r--r-- | ppapi/c/private/ppb_gpu_blacklist_private.h | 4 | ||||
-rw-r--r-- | ppapi/c/private/ppb_nacl_private.h | 12 | ||||
-rwxr-xr-x | ppapi/generators/idl_c_proto.py | 2 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 28 |
9 files changed, 40 insertions, 38 deletions
diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h index b0cb80e..0567120 100644 --- a/ppapi/c/dev/ppb_testing_dev.h +++ b/ppapi/c/dev/ppb_testing_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_testing_dev.idl modified Thu Dec 22 11:02:53 2011. */ +/* From dev/ppb_testing_dev.idl modified Mon Mar 19 12:02:10 2012. */ #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ #define PPAPI_C_DEV_PPB_TESTING_DEV_H_ @@ -94,7 +94,7 @@ struct PPB_Testing_Dev_0_91 { * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE * otherwise. */ - PP_Bool (*IsOutOfProcess)(); + PP_Bool (*IsOutOfProcess)(void); /** * Passes the input event to the browser, which sends it back to the * plugin. The plugin should implement PPP_InputEvent and register for @@ -145,7 +145,7 @@ struct PPB_Testing_Dev_0_7 { void (*RunMessageLoop)(PP_Instance instance); void (*QuitMessageLoop)(PP_Instance instance); uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); - PP_Bool (*IsOutOfProcess)(); + PP_Bool (*IsOutOfProcess)(void); }; struct PPB_Testing_Dev_0_8 { @@ -155,7 +155,7 @@ struct PPB_Testing_Dev_0_8 { void (*RunMessageLoop)(PP_Instance instance); void (*QuitMessageLoop)(PP_Instance instance); uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); - PP_Bool (*IsOutOfProcess)(); + PP_Bool (*IsOutOfProcess)(void); void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event); }; @@ -166,7 +166,7 @@ struct PPB_Testing_Dev_0_9 { void (*RunMessageLoop)(PP_Instance instance); void (*QuitMessageLoop)(PP_Instance instance); uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); - PP_Bool (*IsOutOfProcess)(); + PP_Bool (*IsOutOfProcess)(void); void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event); struct PP_Var (*GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev* components); diff --git a/ppapi/c/ppb_core.h b/ppapi/c/ppb_core.h index 2bbbcb1..135f857 100644 --- a/ppapi/c/ppb_core.h +++ b/ppapi/c/ppb_core.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_core.idl modified Wed Oct 5 14:06:02 2011. */ +/* From ppb_core.idl modified Mon Mar 19 12:02:10 2012. */ #ifndef PPAPI_C_PPB_CORE_H_ #define PPAPI_C_PPB_CORE_H_ @@ -58,7 +58,7 @@ struct PPB_Core_1_0 { * @return A <code>PP_Time</code> containing the "wall clock time" according * to the browser. */ - PP_Time (*GetTime)(); + PP_Time (*GetTime)(void); /** * GetTimeTicks() returns the "tick time" according to the browser. * This clock is used by the browser when passing some event times to the @@ -70,7 +70,7 @@ struct PPB_Core_1_0 { * @return A <code>PP_TimeTicks</code> containing the "tick time" according * to the browser. */ - PP_TimeTicks (*GetTimeTicks)(); + PP_TimeTicks (*GetTimeTicks)(void); /** * CallOnMainThread() schedules work to be executed on the main module thread * after the specified delay. The delay may be 0 to specify a call back as @@ -107,7 +107,7 @@ struct PPB_Core_1_0 { * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. */ - PP_Bool (*IsMainThread)(); + PP_Bool (*IsMainThread)(void); }; typedef struct PPB_Core_1_0 PPB_Core; diff --git a/ppapi/c/ppb_image_data.h b/ppapi/c/ppb_image_data.h index 8879dc6..fb091d7 100644 --- a/ppapi/c/ppb_image_data.h +++ b/ppapi/c/ppb_image_data.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_image_data.idl modified Wed Oct 31 10:35:03 2012. */ +/* From ppb_image_data.idl modified Tue Nov 13 08:48:25 2012. */ #ifndef PPAPI_C_PPB_IMAGE_DATA_H_ #define PPAPI_C_PPB_IMAGE_DATA_H_ @@ -114,7 +114,7 @@ struct PPB_ImageData_1_0 { * * @return A <code>PP_ImageDataFormat</code> containing the preferred format. */ - PP_ImageDataFormat (*GetNativeImageDataFormat)(); + PP_ImageDataFormat (*GetNativeImageDataFormat)(void); /** * IsImageDataFormatSupported() determines if the given image data format is * supported by the browser. Note: <code>PP_IMAGEDATAFORMAT_BGRA_PREMUL</code> diff --git a/ppapi/c/ppb_message_loop.h b/ppapi/c/ppb_message_loop.h index 331360b..c4d2e32 100644 --- a/ppapi/c/ppb_message_loop.h +++ b/ppapi/c/ppb_message_loop.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_message_loop.idl modified Mon Nov 12 13:33:16 2012. */ +/* From ppb_message_loop.idl modified Tue Nov 20 08:49:26 2012. */ #ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_ #define PPAPI_C_PPB_MESSAGE_LOOP_H_ @@ -155,12 +155,12 @@ struct PPB_MessageLoop_1_0 { * Returns a resource identifying the message loop for the main thread. The * main thread always has a message loop created by the system. */ - PP_Resource (*GetForMainThread)(); + PP_Resource (*GetForMainThread)(void); /** * Returns a reference to the PPB_MessageLoop object attached to the current * thread. If there is no attached message loop, the return value will be 0. */ - PP_Resource (*GetCurrent)(); + PP_Resource (*GetCurrent)(void); /** * Sets the given message loop resource as being the associated message loop * for the currently running thread. diff --git a/ppapi/c/ppp.h b/ppapi/c/ppp.h index fad8d6c..3a9f454 100644 --- a/ppapi/c/ppp.h +++ b/ppapi/c/ppp.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppp.idl modified Mon Nov 5 15:50:24 2012. */ +/* From ppp.idl modified Tue Nov 13 08:48:25 2012. */ #ifndef PPAPI_C_PPP_H_ #define PPAPI_C_PPP_H_ @@ -145,7 +145,7 @@ typedef int32_t (*PP_InitializeModule_Func)( /** * Defines the type of the <code>PPP_ShutdownModule</code> function. */ -typedef void (*PP_ShutdownModule_Func)(); +typedef void (*PP_ShutdownModule_Func)(void); /** * Defines the type of the <code>PPP_ShutdownModule</code> function. diff --git a/ppapi/c/private/ppb_gpu_blacklist_private.h b/ppapi/c/private/ppb_gpu_blacklist_private.h index ded56be..f37106e 100644 --- a/ppapi/c/private/ppb_gpu_blacklist_private.h +++ b/ppapi/c/private/ppb_gpu_blacklist_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_gpu_blacklist_private.idl, - * modified Wed Oct 10 15:34:44 2012. + * modified Wed Oct 24 14:41:20 2012. */ #ifndef PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_ @@ -37,7 +37,7 @@ struct PPB_GpuBlacklist_Private_0_2 { * expose the 3D interfaces if the 3D support is software-emulated. When the * SRPC proxy is removed, this interface can also be removed. */ - PP_Bool (*IsGpuBlacklisted)(); + PP_Bool (*IsGpuBlacklisted)(void); }; typedef struct PPB_GpuBlacklist_Private_0_2 PPB_GpuBlacklist_Private; diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index ccb6af9..5794164 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Fri Nov 16 05:20:17 2012. */ +/* From private/ppb_nacl_private.idl modified Tue Nov 20 08:49:26 2012. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -74,15 +74,15 @@ struct PPB_NaCl_Private_1_0 { /* On POSIX systems, this function returns the file descriptor of * /dev/urandom. On non-POSIX systems, this function returns 0. */ - int32_t (*UrandomFD)(); + int32_t (*UrandomFD)(void); /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI * proxy. This is so paranoid admins can effectively prevent untrusted shader * code to be processed by the graphics stack. */ - PP_Bool (*Are3DInterfacesDisabled)(); + PP_Bool (*Are3DInterfacesDisabled)(void); /* Enables the creation of sel_ldr processes off of the main thread. */ - void (*EnableBackgroundSelLdrLaunch)(); + void (*EnableBackgroundSelLdrLaunch)(void); /* This is Windows-specific. This is a replacement for DuplicateHandle() for * use inside the Windows sandbox. Note that we provide this via dependency * injection only to avoid the linkage problems that occur because the NaCl @@ -107,10 +107,10 @@ struct PPB_NaCl_Private_1_0 { PP_FileHandle (*CreateTemporaryFile)(PP_Instance instance); /* Return true if we are off the record. */ - PP_Bool (*IsOffTheRecord)(); + PP_Bool (*IsOffTheRecord)(void); /* Return true if PNaCl is turned on. */ - PP_Bool (*IsPnaclEnabled)(); + PP_Bool (*IsPnaclEnabled)(void); }; typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py index fea5615..7df8311 100755 --- a/ppapi/generators/idl_c_proto.py +++ b/ppapi/generators/idl_c_proto.py @@ -412,6 +412,8 @@ class CGen(object): ptr_prefix='', include_name=True)) if func_as_ptr: name = '(%s*%s)' % (ptr_prefix, name) + if not params: + params = ['void'] out = '%s %s(%s)' % (rtype, name, ', '.join(params)) self.LogExit('Exit Compose: %s' % out) return out diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 741c64a..8aba703 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -273,13 +273,13 @@ void Pnacl_M14_PPB_Core_ReleaseResource(PP_Resource resource) { } static __attribute__((pnaclcall)) -PP_Time Pnacl_M14_PPB_Core_GetTime() { +PP_Time Pnacl_M14_PPB_Core_GetTime(void) { const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface; return iface->GetTime(); } static __attribute__((pnaclcall)) -PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks() { +PP_TimeTicks Pnacl_M14_PPB_Core_GetTimeTicks(void) { const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface; return iface->GetTimeTicks(); } @@ -291,7 +291,7 @@ void Pnacl_M14_PPB_Core_CallOnMainThread(int32_t delay_in_milliseconds, struct P } static __attribute__((pnaclcall)) -PP_Bool Pnacl_M14_PPB_Core_IsMainThread() { +PP_Bool Pnacl_M14_PPB_Core_IsMainThread(void) { const struct PPB_Core_1_0 *iface = Pnacl_WrapperInfo_PPB_Core_1_0.real_iface; return iface->IsMainThread(); } @@ -845,13 +845,13 @@ PP_Resource Pnacl_M25_PPB_MessageLoop_Create(PP_Instance instance) { } static __attribute__((pnaclcall)) -PP_Resource Pnacl_M25_PPB_MessageLoop_GetForMainThread() { +PP_Resource Pnacl_M25_PPB_MessageLoop_GetForMainThread(void) { const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface; return iface->GetForMainThread(); } static __attribute__((pnaclcall)) -PP_Resource Pnacl_M25_PPB_MessageLoop_GetCurrent() { +PP_Resource Pnacl_M25_PPB_MessageLoop_GetCurrent(void) { const struct PPB_MessageLoop_1_0 *iface = Pnacl_WrapperInfo_PPB_MessageLoop_1_0.real_iface; return iface->GetCurrent(); } @@ -1833,7 +1833,7 @@ uint32_t Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instanc } static __attribute__((pnaclcall)) -PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess() { +PP_Bool Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess(void) { const struct PPB_Testing_Dev_0_9 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_9.real_iface; return iface->IsOutOfProcess(); } @@ -1879,7 +1879,7 @@ uint32_t Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance(PP_Instance instanc } static __attribute__((pnaclcall)) -PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess() { +PP_Bool Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess(void) { const struct PPB_Testing_Dev_0_91 *iface = Pnacl_WrapperInfo_PPB_Testing_Dev_0_91.real_iface; return iface->IsOutOfProcess(); } @@ -3385,10 +3385,10 @@ static struct PP_Var Pnacl_M18_PPP_Instance_Private_GetInstanceObject(PP_Instanc struct PPB_Core_1_0 Pnacl_Wrappers_PPB_Core_1_0 = { .AddRefResource = (void (*)(PP_Resource resource))&Pnacl_M14_PPB_Core_AddRefResource, .ReleaseResource = (void (*)(PP_Resource resource))&Pnacl_M14_PPB_Core_ReleaseResource, - .GetTime = (PP_Time (*)())&Pnacl_M14_PPB_Core_GetTime, - .GetTimeTicks = (PP_TimeTicks (*)())&Pnacl_M14_PPB_Core_GetTimeTicks, + .GetTime = (PP_Time (*)(void))&Pnacl_M14_PPB_Core_GetTime, + .GetTimeTicks = (PP_TimeTicks (*)(void))&Pnacl_M14_PPB_Core_GetTimeTicks, .CallOnMainThread = (void (*)(int32_t delay_in_milliseconds, struct PP_CompletionCallback callback, int32_t result))&Pnacl_M14_PPB_Core_CallOnMainThread, - .IsMainThread = (PP_Bool (*)())&Pnacl_M14_PPB_Core_IsMainThread + .IsMainThread = (PP_Bool (*)(void))&Pnacl_M14_PPB_Core_IsMainThread }; struct PPB_FileIO_1_0 Pnacl_Wrappers_PPB_FileIO_1_0 = { @@ -3519,8 +3519,8 @@ struct PPB_Instance_0_5 Pnacl_Wrappers_PPB_Instance_0_5 = { struct PPB_MessageLoop_1_0 Pnacl_Wrappers_PPB_MessageLoop_1_0 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M25_PPB_MessageLoop_Create, - .GetForMainThread = (PP_Resource (*)())&Pnacl_M25_PPB_MessageLoop_GetForMainThread, - .GetCurrent = (PP_Resource (*)())&Pnacl_M25_PPB_MessageLoop_GetCurrent, + .GetForMainThread = (PP_Resource (*)(void))&Pnacl_M25_PPB_MessageLoop_GetForMainThread, + .GetCurrent = (PP_Resource (*)(void))&Pnacl_M25_PPB_MessageLoop_GetCurrent, .AttachToCurrentThread = (int32_t (*)(PP_Resource message_loop))&Pnacl_M25_PPB_MessageLoop_AttachToCurrentThread, .Run = (int32_t (*)(PP_Resource message_loop))&Pnacl_M25_PPB_MessageLoop_Run, .PostWork = (int32_t (*)(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms))&Pnacl_M25_PPB_MessageLoop_PostWork, @@ -3788,7 +3788,7 @@ struct PPB_Testing_Dev_0_9 Pnacl_Wrappers_PPB_Testing_Dev_0_9 = { .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_RunMessageLoop, .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_QuitMessageLoop, .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M17_PPB_Testing_Dev_GetLiveObjectsForInstance, - .IsOutOfProcess = (PP_Bool (*)())&Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess, + .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M17_PPB_Testing_Dev_IsOutOfProcess, .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M17_PPB_Testing_Dev_SimulateInputEvent, .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M17_PPB_Testing_Dev_GetDocumentURL }; @@ -3798,7 +3798,7 @@ struct PPB_Testing_Dev_0_91 Pnacl_Wrappers_PPB_Testing_Dev_0_91 = { .RunMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_RunMessageLoop, .QuitMessageLoop = (void (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_QuitMessageLoop, .GetLiveObjectsForInstance = (uint32_t (*)(PP_Instance instance))&Pnacl_M18_PPB_Testing_Dev_GetLiveObjectsForInstance, - .IsOutOfProcess = (PP_Bool (*)())&Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess, + .IsOutOfProcess = (PP_Bool (*)(void))&Pnacl_M18_PPB_Testing_Dev_IsOutOfProcess, .SimulateInputEvent = (void (*)(PP_Instance instance, PP_Resource input_event))&Pnacl_M18_PPB_Testing_Dev_SimulateInputEvent, .GetDocumentURL = (struct PP_Var (*)(PP_Instance instance, struct PP_URLComponents_Dev* components))&Pnacl_M18_PPB_Testing_Dev_GetDocumentURL, .GetLiveVars = (uint32_t (*)(struct PP_Var live_vars[], uint32_t array_size))&Pnacl_M18_PPB_Testing_Dev_GetLiveVars |