-Wno-format is not honored
Bug #1317305 reported by
Steve Beattie
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.8 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
gcc-4.9 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
Due to the way the gcc-default-
$ cat format-extra-args.c
#include <stdio.h>
/* printf extra arguments example */
int main(void)
{
return 0;
}
$ gcc -Wall -O2 -o format-off format-extra-args.c -Wno-format
format-
format-
printf("%s\n", "argument 1", "argument 2");
^
Earlier versions of gcc allowed disabling warnings correctly.
Changed in gcc-4.9 (Ubuntu): | |
status: | Confirmed → In Progress |
To post a comment you must log in.
Here is an updated version of the gcc-default- format- security. diff patch that enables -Wformat=1 and -Wformat-security by default, but honors users' -Wformat arguments to override the default.
This fixes the following gcc testcase failures:
-FAIL: gcc.dg/ format/ nonlit- 2.c -Wformat=0 non-literal (test for warnings, line 11) format/ nonlit- 2.c -Wformat=0 non-literal (test for warnings, line 12) format/ nonlit- 2.c -DWIDE -Wformat=0 non-literal (test for warnings, line 11) format/ nonlit- 2.c -DWIDE -Wformat=0 non-literal (test for warnings, line 12) format/ opt-1.c -Wformat=0 ignored (test for warnings, line ) format/ opt-1.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ opt-2.c -Wformat=0 ignored (test for warnings, line ) format/ opt-2.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ opt-3.c -Wformat=0 ignored (test for warnings, line ) format/ opt-3.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ opt-4.c -Wformat=0 ignored (test for warnings, line ) format/ opt-4.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ opt-5.c -Wformat=0 ignored (test for warnings, line ) format/ opt-5.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ opt-6.c -Wformat=0 ignored (test for warnings, line ) format/ opt-6.c -DWIDE -Wformat=0 ignored (test for warnings, line ) format/ plus-1. c -Wformat=0 non-constant addend (test for warnings, line 16) format/ plus-1. c -Wformat=0 minus constant (test for warnings, line 18) format/ plus-1. c -Wformat=0 negative addend (test for warnings, line 19) format/ plus-1. c -DWIDE -Wformat=0 non-constant addend (test for warnings, line 16) format/ plus-1. c -DWIDE -Wformat=0 minus constant (test for warnings, line 18) format/ plus-1. c -DWIDE -Wformat=0 negative addend (test for warnings, line 19)
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
-FAIL: gcc.dg/
Note that this patch is for gcc-4.9 and applies on top of the modified patch to enable -fstack- protector- strong by default in bug 1317307. I'll prepare a patch for gcc-4.8 for use in an SRU in a bit.
I've also added tests to lp:qa-regression-testing to ensure that passed command line arguments are honored over the default.