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]

Re: [C PATCH] Better location for switch warnings (PR c/30020)


On 06/04/14 00:46, Marek Polacek wrote:
It is trivial to pass the location from c_add_case_label down to
check_case_bounds, so do that.  With it, we instead of

i.c:4:3: warning: case label value is less than minimum value for type
    switch (c) { case 42: case -1: return -1; };
    ^
output
i.c:4:25: warning: case label value is less than minimum value for type
    switch (c) { case 42: case -1: return -1; };
                          ^
which is better.

Tested x86_64, ok for trunk?

2014-06-04  Marek Polacek  <polacek@redhat.com>

	PR c/30020
	* c-common.c (check_case_bounds): Add location parameter.
	Use it.
	(c_add_case_label): Pass loc to check_case_bounds.

	* c-c++-common/pr30020.c: New test.
OK.

ISTM that additional patches of this nature (add location parameter to get better diagnostics) ought to be considered pre-approved.



jeff


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