summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alk@tut.by>2015-08-01 11:24:56 -0700
committerAliaksey Kandratsenka <alk@tut.by>2015-08-01 11:24:56 -0700
commitb5b79860fd2b8e1a9b0573e93f942695f2992b59 (patch)
tree27ca4f4850d0498fcc33c96f57ed2870b5715983
parent7df7f14c949d89d9c3f5c7c339bbdda81fb8abc7 (diff)
downloadgperftools-b5b79860fd2b8e1a9b0573e93f942695f2992b59.tar.gz
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.
-rw-r--r--src/gperftools/profiler.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gperftools/profiler.h b/src/gperftools/profiler.h
index 050689d..2d272d6 100644
--- a/src/gperftools/profiler.h
+++ b/src/gperftools/profiler.h
@@ -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 {