aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-10-25 07:49:16 +0000
committerIain Sandoe <iain@sandoe.co.uk>2020-11-13 10:39:48 +0000
commit3fe07cdec8c79bce53ea5aeb8e607df6eb5c8c2c (patch)
tree989f0b35f1a61b36a0bfc388398ec51850bf1de3 /libgo
parent4852c3266ec0887316b9fbbb106b8540e3e948d6 (diff)
downloadgcc-3fe07cdec8c79bce53ea5aeb8e607df6eb5c8c2c.zip
gcc-3fe07cdec8c79bce53ea5aeb8e607df6eb5c8c2c.tar.gz
gcc-3fe07cdec8c79bce53ea5aeb8e607df6eb5c8c2c.tar.bz2
C-family, Objective-C [1/3] : Implement Wobjc-root-class [PR77404].
This warning catches the case that the user has left the superclass specification from a class interface. Root classes are, of course, permitted and an attribute is added to mark these so that the diagnostic is suppressed. The warning and attribute spellings have been kept in sync with the language reference implementation (clang). The diagnostic location information present in the objective-c interface and class definitions is relatively poor. This patch adds a location for the class name to the interface and makes use of it in existing warnings. Part 1 is the changes to code and added tests. Many entries in the testsuite make use of root classes so there are a large number of mechanical changes there adding "-Wno-objc-root-class" to the options. The test changes are parts 2 (objective-c) and 3 (objective-c++) in the patch series. gcc/c-family/ChangeLog: PR objc/77404 * c-attribs.c (handle_objc_root_class_attribute): New * c-objc.h (objc_start_class_interface): Add a location value for the position of the class name. * c.opt: Add Wobjc-root-class. * stub-objc.c (objc_start_class_interface): Add a location value for the position of the class name. gcc/c/ChangeLog: PR objc/77404 * c-parser.c (c_parser_objc_class_definition): Pass the location of the class name to the interface declaration. gcc/cp/ChangeLog: PR objc/77404 * parser.c (cp_parser_objc_class_interface): Pass the location of the class name to the interface declaration. gcc/objc/ChangeLog: PR objc/77404 * objc-act.c (objc_start_class_interface): Accept the location of the class name, use it in existing diagnostic. (start_class): Accept obj_root_class type attributes. Warn when the interface for an implementation does not contain a super class (unless the diagnostic is suppressed by the the command line flag or the objc_root_class type attribute). gcc/testsuite/ChangeLog: PR objc/77404 * objc.dg/attributes/root-class-01.m: New test. * objc.dg/root-class-00.m: New test. * obj-c++.dg/attributes/root-class-01.mm: New test. * obj-c++.dg/root-class-00.mm: New test. gcc/ChangeLog: PR objc/77404 * doc/extend.texi: Document the objc_root_class attribute. * doc/invoke.texi: Document -Wobjc-root-class.
Diffstat (limited to 'libgo')
0 files changed, 0 insertions, 0 deletions