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

Inhibit GCC warning -Wmaybe-uninitialized in DMD_OBJS #3543

Merged
merged 1 commit into from May 13, 2014

Conversation

nordlow
Copy link
Contributor

@nordlow nordlow commented May 11, 2014

First of a bunch starting with possible Heisenbugs.

Should I fix GLUE, BACK and ROOT aswell in this commit?

Floating points are nan-initialized when needed. I'm however unsure about the string arguments to nan, nanl, nanf so I've set them to ? for now.

I've further explicitly added -Wno... to all issued by -Wall and -Wextra both a common set and those specific to either GCC or Clang. Each one can then be removed from WARNINGS and instead put into (DMD|GLUE|BACK|ROOT)_FLAGS instead.

This may require some logic as some of these flags are not compatible with both GCC and Clang. For now this -Wmaybe-uninitialized issue warnings when dmd is compiled using Clang. This logic needs to be fixed somehow. Tell me how you want this and I'll fix it :)

Update: I see now that the failure on test compile hosts with older GCC requires casing on compiler version instead if we want to use newer warnings such as -Wmaybe-uninitialized. Should we implement this casing or start inhibiting other warnings from -Wall and -Wextra that are compatible with previous GCC versions and then finally activate -Wextra?

@yebblies
Copy link
Member

Are any of these not false positives? I'd rather just leave this as-is as they'll automatically be initialized when we switch the frontend to D. If you've found actual bugs that's a different story.

@nordlow
Copy link
Contributor Author

nordlow commented May 12, 2014

The main reason for removing warnings issued by a specific warning flag is not to find current bugs, but to prevent users from accidentally adding new ones without them knowing about it.

If the output is littered with warnings the user wont read the new ones he causes. -Wmaybe-unitialized can cause Heisenbugs and these are the most difficult to track down. I'll try using -Wuninitialized instead and see what happens.

@@ -3984,6 +3984,8 @@ Expression *Parser::parseDefaultInitExp()
e = new FuncInitExp(token.loc);
else if (token.value == TOKprettyfunc)
e = new PrettyFuncInitExp(token.loc);
else
e = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace e = NULL; with assert(0);

@WalterBright
Copy link
Member

I don't really know what to do about the flags that are not common to gcc and clang - I suggest leave them there, but comment them out with an explanation.

@WalterBright
Copy link
Member

The main reason for removing warnings issued by a specific warning flag is not to find current bugs, but to prevent users from accidentally adding new ones without them knowing about it.

Yup, exactly right.

@yebblies
Copy link
Member

The main reason for removing warnings issued by a specific warning flag is not to find current bugs, but to prevent users from accidentally adding new ones without them knowing about it.

Switching to D gets rid of all these warnings.

@nordlow
Copy link
Contributor Author

nordlow commented May 13, 2014

I've fixed your comments.

Floats are set to 0.0 instead of nan.

I also added a dependency to posix.mak itself for each object built so code is rebuilt whenever I change the warnings. I hope that's ok.

@WalterBright
Copy link
Member

Auto-merge toggled on

WalterBright added a commit that referenced this pull request May 13, 2014
Inhibit GCC warning -Wmaybe-uninitialized in DMD_OBJS
@WalterBright WalterBright merged commit cf92eed into dlang:master May 13, 2014
@nordlow
Copy link
Contributor Author

nordlow commented May 18, 2014

Should I continue fixing GLUE, BACK and ROOT or focus on remaining warnings in DMD?

@nordlow nordlow deleted the inhibit-Wmaybe-uninitialized branch October 19, 2021 19:43
ibuclaw pushed a commit to ibuclaw/dmd that referenced this pull request Jul 10, 2022
Fix Issue 22218 - Dynamic casts across binary boundaries can easily fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants