This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Encode Wnormalized= is c.opt


This patch moves handling of Wnormalized= to c.opt.

There were two quirks when doing this:

1) I cannot use the cpplib.h type 'enum cpp_normalize_level' as Type()
because this will require including cpplib.h into options.h, which in
turn causes a lot of problems, thus I needed to use Type(int).
Similarly, I cannot use this type in the CPP option warn_normalize,
because C++ does not allow conversions from int to this enum.

2) The code in c_common_handle_option seems to say that -Wnormalized=
is equivalent to -Wnormalized=nfkc. However, -Wnormalized= was already
rejected as not valid. Moreover, it emits a note for
-Werror=normalized= saying that it is equivalent to -Wnormalized=nfc,
however, this note is never actually emitted since the code never
reaches that condition, so I chose to not even try to replicate the
note or allow -Wnormalized=. Surprisingly, -Werror=normalized= was
already equivalent to what -Werror=normalized would do, but
-Werror=normalized was rejected because -Wnormalized did not exist.
Thus, I added -Wnormalized to handle this corner case.

In summary, after the patch the only behavior changes are that
-Werror=normalized, -Wnormalized and -Wno-normalized work.

Bootstrapped and regression tested on x86_64-linux-gnu

OK?


gcc/ChangeLog:

2014-09-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * doc/invoke.texi (Wnormalized=): Update.

libcpp/ChangeLog:

2014-09-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * include/cpplib.h (struct cpp_options): Declare warn_normalize as
    int instead of enum.

gcc/c-family/ChangeLog:

2014-09-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * c.opt    (Wnormalized): New.
    (Wnormalized=): Use Enum and Reject Negative.
    * c-opts.c (c_common_handle_option): Do not handle Wnormalized here.

gcc/testsuite/ChangeLog:

2014-09-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    * gcc.dg/cpp/warn-normalized-3.c: Delete useless dg-prune-output.

Attachment: cpp_normalized.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]