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, C++: Fix PR 69733 (bad location for ignored qualifiers warning)


On 05/04/2016 09:17 AM, Bernd Schmidt wrote:
On 04/25/2016 10:18 PM, Joseph Myers wrote:
On Fri, 22 Apr 2016, Bernd Schmidt wrote:

+/* Returns the smallest location != UNKNOWN_LOCATION in LOCATIONS,
+   considering only those c_declspec_words found in LIST, which
+   must be terminated by cdw_number_of_elements.  */
+
+static location_t
+smallest_type_quals_location (const location_t* locations,
+                  c_declspec_word *list)

I'd expect list to be a pointer to const...

@@ -6101,6 +6122,18 @@ grokdeclarator (const struct c_declarato
             qualify the return type, not the function type.  */
          if (type_quals)
            {
+        enum c_declspec_word ignored_quals_list[] =
+          {
+            cdw_const, cdw_volatile, cdw_restrict, cdw_address_space,
+            cdw_number_of_elements
+          };

  ... and ignored_quals_list to be static const here.

How's this? Fully retested on x86_64-linux.


Bernd

declspecs-v2.diff


c/
	PR c++/69733
	* c-decl.c (smallest_type_quals_location): New static function.
	(grokdeclarator): Try to find the correct location for an ignored
	qualifier.
cp/
	PR c++/69733
	* decl.c (grokdeclarator): Try to find the correct location for an
	ignored qualifier.
testsuite/
	PR c++/69733
	* c-c++-common/pr69733.c: New test.
	* gcc.target/i386/pr69733.c: New test.
It looks like this stalled...

Anyway, it's fine for the trunk.

Thanks,
Jeff


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