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:
Aliaksey Kandratsenka 2015-08-01 11:24:56 -07:00
parent 7df7f14c94
commit b5b79860fd

View File

@ -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 {