aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-09-16 00:02:09 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-09-15 20:02:09 -0400
commit777ffbda17411f46ff30809f27369e47af5bfccf (patch)
treebc99db4da32e7577215fbd3f950bbd30b6ab7dae /gcc
parentd4c2d8af7649dde57e7a9089755f2842eed8a34f (diff)
downloadgcc-777ffbda17411f46ff30809f27369e47af5bfccf.zip
gcc-777ffbda17411f46ff30809f27369e47af5bfccf.tar.gz
gcc-777ffbda17411f46ff30809f27369e47af5bfccf.tar.bz2
lex.c (cp_pragma_implementation): Allow #pragma implementation in header files.
* lex.c (cp_pragma_implementation): Allow #pragma implementation in header files. From-SVN: r29444
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/lex.c56
2 files changed, 22 insertions, 44 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 696f290..69250a4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (cp_pragma_implementation): Allow #pragma implementation
+ in header files.
+
1999-09-15 Richard Henderson <rth@cygnus.com>
* lex.c (mark_impl_file_chain): Follow the next chain.
@@ -13,11 +18,6 @@
* typeck2.c (ack): Don't declare progname.
-1999-09-15 Nathan Sidwell <nathan@acm.org>
-
- * typeck.c (expr_sizeof): Reinstall and augment OFFSET_REF
- comment.
-
1999-09-14 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* lex.c (cp_pragma_interface, cp_pragma_implementation): Copy
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 832af45..77b5e3c 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1238,53 +1238,31 @@ cp_pragma_interface (main_filename)
TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
}
+/* Note that we have seen a #pragma implementation for the key MAIN_FILENAME.
+ We used to only allow this at toplevel, but that restriction was buggy
+ in older compilers and it seems reasonable to allow it in the headers
+ themselves, too. It only needs to precede the matching #p interface.
+
+ We don't touch interface_only or interface_unknown; the user must specify
+ a matching #p interface for this to have any effect. */
+
static void
cp_pragma_implementation (main_filename)
char *main_filename;
{
- tree fileinfo
- = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename));
-
- if (impl_file_chain)
+ struct impl_files *ifiles = impl_file_chain;
+ for (; ifiles; ifiles = ifiles->next)
{
- struct impl_files *ifiles = impl_file_chain;
- while (ifiles)
- {
- if (! strcmp (ifiles->filename, main_filename))
- break;
- ifiles = ifiles->next;
- }
- if (ifiles == 0)
- {
- ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
- ifiles->filename = ggc_alloc_string (main_filename, -1);
- ifiles->next = impl_file_chain;
- impl_file_chain = ifiles;
- }
+ if (! strcmp (ifiles->filename, main_filename))
+ break;
}
- else if ((main_input_filename != 0
- && ! strcmp (main_input_filename, input_filename))
- || ! strcmp (main_filename, input_filename))
+ if (ifiles == 0)
{
- impl_file_chain = (struct impl_files*) xmalloc (sizeof (struct impl_files));
- impl_file_chain->filename = ggc_alloc_string (main_filename, -1);
- impl_file_chain->next = 0;
+ ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
+ ifiles->filename = ggc_alloc_string (main_filename, -1);
+ ifiles->next = impl_file_chain;
+ impl_file_chain = ifiles;
}
- else
- error ("`#pragma implementation' can only appear at top-level");
- interface_only = 0;
-#if 1
- /* We make this non-zero so that we infer decl linkage
- in the impl file only for variables first declared
- in the interface file. */
- interface_unknown = 1;
-#else
- /* We make this zero so that templates in the impl
- file will be emitted properly. */
- interface_unknown = 0;
-#endif
- TREE_INT_CST_LOW (fileinfo) = interface_only;
- TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
}
/* Set up the state required to correctly handle the definition of the