0

I am writing a gcc wrapper that will invoke gcc on my source file with the -Wall compile flag set. If there is no errors or warnings, it will execute the output binary.

The exit status off gcc will be 1 if there is a error. But it will be zero even if there is a warning.

So how do I detect if gcc produced any warnings in my shell script?

1

The easiest way is to add to the gcc command the option -Werror which makes all warnings into errors.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.