aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lex.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2007-08-22 13:23:37 -0400
committerJason Merrill <jason@gcc.gnu.org>2007-08-22 13:23:37 -0400
commit6117220672481e5dea35a26a576b4794b5661d60 (patch)
tree15ee08cdd7c8f4fd56f28d2c93470b2102542aba /gcc/cp/lex.c
parent1840f0c27011ba23f29540d509b275e558fa4cb0 (diff)
downloadgcc-6117220672481e5dea35a26a576b4794b5661d60.zip
gcc-6117220672481e5dea35a26a576b4794b5661d60.tar.gz
gcc-6117220672481e5dea35a26a576b4794b5661d60.tar.bz2
re PR c++/29365 (Unnecessary anonymous namespace warnings)
PR c++/29365 * pt.c (outermost_tinst_level): New function. * lex.c (in_main_input_context): New function. * decl2.c (constrain_class_visibility): Use it to avoid warning about uses of the anonymous namespace in the main input file. From-SVN: r127711
Diffstat (limited to 'gcc/cp/lex.c')
-rw-r--r--gcc/cp/lex.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 3a2caec..e62887d 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -849,3 +849,18 @@ make_aggr_type (enum tree_code code)
return t;
}
+
+/* Returns true if we are currently in the main source file, or in a
+ template instantiation started from the main source file. */
+
+bool
+in_main_input_context (void)
+{
+ tree tl = outermost_tinst_level();
+
+ if (tl)
+ return strcmp (main_input_filename,
+ LOCATION_FILE (TINST_LOCATION (tl))) == 0;
+ else
+ return strcmp (main_input_filename, input_filename) == 0;
+}