Hi all, I don't know if this is the right time to submit such patches. But this patch attempts to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31566
I have successfully bootstrapped and tested on x86_64-pc-linux-gnu testcases: file: -Wall test.c: void foo() { int a,b; a = b + 1; } @test2: void foo() { int a,b; a = b + 1; } case 1: file and test.c are present ./gcc @file test.c -c test.c: In function ‘foo’: test.c:3:7: warning: variable ‘a’ set but not used [-Wunused-but-set-variable] int a,b; ^ test.c:4:5: warning: ‘b’ is used uninitialized in this function [-Wuninitialized] a = b + 1; ~~^~~~~~~ case 2: file1 is not present and test.c,file are present ./gcc @file @file1 test.c -c gcc: error: file1: No such file or directory case 3: file is present and test1.c is not present ./gcc @file test1.c -c gcc: error: test1.c: No such file or directory gcc: fatal error: no input files compilation terminated. case 4: file1 and test1.c both are not present ./gcc @file1 test1.c -c gcc: error: file1: No such file or directory gcc: error: test1.c: No such file or directory gcc: fatal error: no input files compilation terminated. case 5: @test2.c is present ./gcc @test2.c -c -> compiled successfully without any error/warning case 6: both file and @test2.c are present ./gcc @file @test2.c -c @test2.c: In function ‘foo’: @test2.c:3:7: warning: variable ‘a’ set but not used [-Wunused-but-set-variable] int a,b; ^ @test2.c:4:5: warning: ‘b’ is used uninitialized in this function [-Wuninitialized] a = b + 1; ~~^~~~~~~ case 7: @file1 is not present and @test2.c is present ./gcc @file1 @test2.c -c gcc: error: file1: No such file or directory case 8: both @file1 and @test3.c are not present gcc: error: file1: No such file or directory gcc: error: test3.c: No such file or directory gcc: fatal error: no input files compilation terminated. -- in this case @test3.c is treated as a file with arguments (test3.c) Thanks, Prasad
diff --git a/gcc/gcc.c b/gcc/gcc.c index d3e8c88..fd2b182 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -4417,7 +4417,12 @@ process_command (unsigned int decoded_options_count, fname = xstrdup (arg); if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0) - perror_with_name (fname); + { + if (fname[0] == '@' && access (fname + 1, F_OK) < 0) + perror_with_name (fname + 1); + else + perror_with_name (fname); + } else add_infile (arg, spec_lang);
changelog
Description: Binary data