mirror of
https://github.com/gperftools/gperftools
synced 2025-01-25 16:33:52 +00:00
issue-702: correctly declare arg-less functions in profiler.h
This is patch by user mitchblank. From his words: The problem is pretty simple. Ancient C code allowed declarations without argument prototypes, i.e. int foo(); For compatibility this is still accepted. If you want to declare a function with zero prototypes the correct way to do it is: int foo(void); C++ also accepts this syntax, but it's not needed there. Normally compilers still accept the old-style entries, but with sufficient warning flags gcc will complain about them. It is good for header files to have the explicit "void" argument so all compilers are kept happy. I'm attaching a simple patch to add the "void" parameter to that file. I haven't checked if other headers have the same problem (I'm just using the profiler at the moment) <end of quote> In fact "int foo()" means "foo accepts any args" and we really want "foo has no args". For which int foo (void) is right declaration.
This commit is contained in:
parent
7df7f14c94
commit
b5b79860fd
@ -132,26 +132,26 @@ PERFTOOLS_DLL_DECL int ProfilerStartWithOptions(
|
||||
/* Stop profiling. Can be started again with ProfilerStart(), but
|
||||
* the currently accumulated profiling data will be cleared.
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL void ProfilerStop();
|
||||
PERFTOOLS_DLL_DECL void ProfilerStop(void);
|
||||
|
||||
/* Flush any currently buffered profiling state to the profile file.
|
||||
* Has no effect if the profiler has not been started.
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL void ProfilerFlush();
|
||||
PERFTOOLS_DLL_DECL void ProfilerFlush(void);
|
||||
|
||||
|
||||
/* DEPRECATED: these functions were used to enable/disable profiling
|
||||
* in the current thread, but no longer do anything.
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL void ProfilerEnable();
|
||||
PERFTOOLS_DLL_DECL void ProfilerDisable();
|
||||
PERFTOOLS_DLL_DECL void ProfilerEnable(void);
|
||||
PERFTOOLS_DLL_DECL void ProfilerDisable(void);
|
||||
|
||||
/* Returns nonzero if profile is currently enabled, zero if it's not. */
|
||||
PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads();
|
||||
PERFTOOLS_DLL_DECL int ProfilingIsEnabledForAllThreads(void);
|
||||
|
||||
/* Routine for registering new threads with the profiler.
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL void ProfilerRegisterThread();
|
||||
PERFTOOLS_DLL_DECL void ProfilerRegisterThread(void);
|
||||
|
||||
/* Stores state about profiler's current status into "*state". */
|
||||
struct ProfilerState {
|
||||
|
Loading…
Reference in New Issue
Block a user