> 1. There are legitimate use-cases where GCC's assumption does not hold, .e.g.:
>
> #include <stdio.h>
>
> void foo( int a )
> {
>   char hello0[] = "hello0";

foo.c line 5: warning: 'const' omitted

>   char hello1[] = "hello1";

foo.c line 6: warning: 'const' omitted

>
>   char *ptr;

foo.c line 8: warning: 'const' omitted

>
>   switch (a % 2) {
>   case 0: ptr = hello0;
>     break;
>   case 1: ptr = hello1;
>     break;
>   }
>
>   printf( ptr );
> }
>
> => The warning GCC issues is plain wrong.
>
> => -Werror=format-security removes the functionality of assigning pointers to 
> format strings even if they are constant.

The example does not support this argument because the example omitted the 
'const' (three places.)
gcc-4.[89] isn't advanced enough to distinguish, but the example does not match 
the argument.

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Reply via email to