Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EverParse generated code should compile /W4 /WX clean #73

Open
Alan-Jowett opened this issue Apr 4, 2022 · 2 comments
Open

EverParse generated code should compile /W4 /WX clean #73

Alan-Jowett opened this issue Apr 4, 2022 · 2 comments

Comments

@Alan-Jowett
Copy link

EverParse generated code should compile /W4 /WX clean.

Code in https://github.com/microsoft/ebpf-for-windows/ is expected to compile with /W4 /WX, but the code generated by EverParse is not /W4 clean.

@nikswamy
Copy link
Contributor

nikswamy commented Apr 5, 2022

hi @Alan-Jowett

When building EverParse generated code with the Visual C/C++ compiler, we use the following settings

/W4 /WX /wd4127 /wd4204 /wd4100 /wd4201

Where, we suppress:

  • error C4100: unreferenced formal parameter, since in some optimized validators the input buffer does not need to be read at all (just a size check will do). It may be possible to generate code with a dummy call to a macro, e.g., UNREFERENCE_PARAMETER(x) or something like that, which may be a replacement for suppressing error 4100.

As for the others, our generate code does pervasively use the features that these warnings complain about. I don't see an easy way for our code generator to not use these features.

  • error C4127: conditional expression is constant
  • error C4204: nonstandard extension used: non-constant aggregate initializer
  • error C4201: nonstandard extension used: nameless struct/union

@tahina-pro
Copy link
Member

C4100 (unreferenced formal parameter) should now be avoided with #102.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants