On Aug 30, 2016, at 4:57 AM, Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> wrote: > > On 30 August 2016 at 17:11, Eric Gallager <eg...@gwmail.gwu.edu> wrote: >> On 8/29/16, Jason Merrill <ja...@redhat.com> wrote: >>> On Mon, Aug 29, 2016 at 10:28 AM, Marek Polacek <pola...@redhat.com> wrote: >>>> On Mon, Aug 29, 2016 at 09:20:53AM -0400, Eric Gallager wrote: >>>>> I tried this patch on my fork of gdb-binutils and got a few warnings >>>>> from it. Would it be possible to have the caret point to the argument >>>>> mentioned, instead of the function name? And also print the option >>>>> name? E.g., instead of the current: >>>>> >>>>> or32-opc.c: In function ‘or32_print_register’: >>>>> or32-opc.c:956:3: warning: passing argument 1 to restrict qualified >>>>> parameter aliases with argument 3 >>>>> sprintf (disassembled, "%sr%d", disassembled, regnum); >>>>> ^~~~~~~ >>>>> >>>>> could it look like: >>>>> >>>>> or32-opc.c: In function ‘or32_print_register’: >>>>> or32-opc.c:956:3: warning: passing argument 1 to restrict qualified >>>>> parameter aliases with argument 3 [-Wrestrict] >>>>> sprintf (disassembled, "%sr%d", disassembled, regnum); >>>>> ^~~~~~~~~~~~ >>>>> >>>>> instead? >>>> >>>> I didn't try to implement it, but I think this should be fairly easy to >>>> achieve in the C FE, because c_parser_postfix_expression_after_primary >>>> has arg_loc, which is a vector of parameter locations. >>> >>> The C++ FE doesn't have this currently, but it could be added without >>> too much trouble: in cp_parser_parenthesized_expression_list, extract >>> the locations from the cp_expr return value of >>> cp_parser_assignment_expression, and then pass the locations back up >>> to cp_parser_postfix_expression. >>> >>> Jason >>> >> >> >> On the topic of how to get this warning working with various >> frontends, is there any reason why the Objective C frontend doesn't >> handle -Wrestrict? Currently when trying to use it, it just says: >> >> cc1obj: warning: command line option '-Wrestrict' is valid for C/C++ >> but not for ObjC > Hi Eric, > I am not sure if restrict is valid for ObjC/Obj-C++ and hence didn't > add the option for these front-ends. > If it is valid, I will enable the option for ObjC and Obj-C++.
This is wrong, C/C++ options should always be ObjC/ObjC++ options.