diff options
author | Theophile Ranquet <ranquet@lrde.epita.fr> | 2012-10-26 18:12:53 +0000 |
---|---|---|
committer | Theophile Ranquet <ranquet@lrde.epita.fr> | 2012-10-26 18:28:37 +0000 |
commit | 697a8022c656f8081d71d470e7b538f699af372c (patch) | |
tree | 84ae7d5426b197f7172992f9e8e897015db1e160 /src/complain.h | |
parent | 8f6bbe0c106114eec8988eadaa25d59969439986 (diff) | |
download | bison-697a8022c656f8081d71d470e7b538f699af372c.tar.gz |
warnings: fix early exit of warnings treated as errors
Treating warnings as errors caused Bison to exit earlier than needed, making it
hide warnings that would have been printed had -Werror not been set.
Also, fix a bug that caused some context information of errors to not be
shown.
* src/complain.c (complaint_issued): Rename as...
(complaint_status): This, and change its type from boolean to
* src/complain.h (err_status): This, new enumeration.
* src/main.c (main): Adjust (only finish early if an actual complaint was
risen, not a mere warning treated an error).
* src/reader.c: Adjust.
Diffstat (limited to 'src/complain.h')
-rw-r--r-- | src/complain.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/complain.h b/src/complain.h index 6a871d82..56ddfa04 100644 --- a/src/complain.h +++ b/src/complain.h @@ -70,7 +70,18 @@ void complain_indent (location const *loc, warnings flags, unsigned *indent, char const *message, ...) __attribute__ ((__format__ (__printf__, 4, 5))); + +/** Warnings treated as errors shouldn't stop the execution as regular errors + should (because due to their nature, it is safe to go on). Thus, there are + three possible execution statuses. */ +typedef enum + { + status_none, + status_warning_as_error, + status_complaint + } err_status; + /** Whether an error was reported. */ -extern bool complaint_issued; +extern err_status complaint_status; #endif /* !COMPLAIN_H_ */ |