aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-01-05 15:17:07 +0100
committerMartin Liska <marxin@gcc.gnu.org>2017-01-05 14:17:07 +0000
commitcd445b543ce675338249055ee7493cc54777307a (patch)
tree72c5de1a0c5a0b8527523460c19488c70c3a5292 /gcc
parentabbaf885599e98c6b9194f672c9a4455d83a5972 (diff)
downloadgcc-cd445b543ce675338249055ee7493cc54777307a.zip
gcc-cd445b543ce675338249055ee7493cc54777307a.tar.gz
gcc-cd445b543ce675338249055ee7493cc54777307a.tar.bz2
Error for '-' as filename of a precompiled header (PR pch/78970)
2017-01-05 Martin Liska <mliska@suse.cz> PR pch/78970 * c-opts.c (c_common_post_options): Reject '-' filename for a precompiled header. 2017-01-05 Martin Liska <mliska@suse.cz> PR pch/78970 * gcc.c (lookup_compiler): Reject '-' filename for a precompiled header. From-SVN: r244103
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-opts.c7
-rw-r--r--gcc/gcc.c11
4 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cccfd7d..28b46e4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-05 Martin Liska <mliska@suse.cz>
+
+ PR pch/78970
+ * gcc.c (lookup_compiler): Reject '-' filename for a precompiled
+ header.
+
2017-01-05 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390.c (s390_expand_setmem): Unroll the loop for
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b9bb5fe..7ec36dc 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-05 Martin Liska <mliska@suse.cz>
+
+ PR pch/78970
+ * c-opts.c (c_common_post_options): Reject '-' filename for a precompiled
+ header.
+
2017-01-04 Marek Polacek <polacek@redhat.com>
PR c++/64767
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 14e038c..7dea165 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -744,7 +744,12 @@ c_common_post_options (const char **pfilename)
in_fnames[0] = "";
}
else if (strcmp (in_fnames[0], "-") == 0)
- in_fnames[0] = "";
+ {
+ if (pch_file)
+ error ("cannot use %<-%> as input filename for a precompiled header");
+
+ in_fnames[0] = "";
+ }
if (out_fname == NULL || !strcmp (out_fname, "-"))
out_fname = "";
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8154953..1d2ed99 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -8325,7 +8325,16 @@ lookup_compiler (const char *name, size_t length, const char *language)
{
for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
if (cp->suffix[0] == '@' && !strcmp (cp->suffix + 1, language))
- return cp;
+ {
+ if (name != NULL && strcmp (name, "-") == 0
+ && (strcmp (cp->suffix, "@c-header") == 0
+ || strcmp (cp->suffix, "@c++-header") == 0))
+ fatal_error (input_location,
+ "cannot use %<-%> as input filename for a "
+ "precompiled header");
+
+ return cp;
+ }
error ("language %s not recognized", language);
return 0;