level-zero icon indicating copy to clipboard operation
level-zero copied to clipboard

Please use `(void)` and not `()`

Open TApplencourt opened this issue 1 year ago • 4 comments

For example in: https://github.com/oneapi-src/level-zero/blob/de1e9f42641cf7513672c2f3a5c306034a4f7e96/include/loader/ze_loader.h#L97C16-L97C46

I suppose here you mean no parameter, not unknow number of parameters.

The other are

h2yaml diagnostic: modified_include/loader/ze_loader.h:71:1: Warning: `zelSetDriverTeardown` defines a function with no parameters, consider specifying `void`.
h2yaml diagnostic: modified_include/loader/ze_loader.h:77:1: Warning: `zelSetDelayLoaderContextTeardown` defines a function with no parameters, consider specifying `void`.
h2yaml diagnostic: modified_include/loader/ze_loader.h:83:1: Warning: `zelLoaderContextTeardown` defines a function with no parameters, consider specifying `void`.
h2yaml diagnostic: modified_include/loader/ze_loader.h:89:1: Warning: `zelEnableTracingLayer` defines a function with no parameters, consider specifying `void`.
h2yaml diagnostic: modified_include/loader/ze_loader.h:95:1: Warning: `zelCheckIsLoaderInTearDown` defines a function with no parameters, consider specifying `void`.
h2yaml diagnostic: modified_include/loader/ze_loader.h:136:1: Warning: `zelDisableTracingLayer` defines a function with no parameters, consider specifying `void`.

TApplencourt avatar Jun 03 '25 19:06 TApplencourt

For C++ () has always meant (void), wheres the latest C23 standard finally applied same interpretation for C (requires -std=c23 option for GCC/Clang/LLVM).

The indicated APIs are all in the API tracing layer ze_loader.h API header. Its users inside this project are all C++ code, so these APIs are interpreted correctly for them.

But I do do agree that that this trivial fix should be done as it's a C-API for header included to level-zero-devel package, and LTS distros haven't enabled C23 for compilers yet.

It's rather low impact though, as it's quite unlikely that there are:

  • Tracing layer implementations outside this project,
  • That are implemented in C (instead of e.g. C++), and
  • Would have a bug due to header assuming C++ / C23...

eero-t avatar May 07 '26 09:05 eero-t

Agree. Pretty low impact, just a simple "beauty" fix.

Concerning your two points:

  • Tracing layer implementations outside this project,
  • That are implemented in C (instead of e.g. C++)

You have one: me ! 😄 (via https://github.com/argonne-lcf/THAPI/). But you are right, we don't trigger your third point.

TApplencourt avatar May 07 '26 09:05 TApplencourt

Thanks, that looks interesting project! As you're supporting many different APIs, I guess -std=c23 is out of question, at least currently.

(I'm not loader maintainer, just another user of L0 APIs.)

eero-t avatar May 07 '26 10:05 eero-t

(I'm not loader maintainer, just another user of L0 APIs.)

:D Their is dozen of us. Dozen!

TApplencourt avatar May 08 '26 07:05 TApplencourt

@TApplencourt Please take a look at the attached review and see if this resolves your issue.

rwmcguir avatar Jul 15 '26 22:07 rwmcguir

Thanks a lot!

TApplencourt avatar Jul 16 '26 21:07 TApplencourt