re PR c++/26195 (pragma interface no longer handles explicit names)

PR c++/26195
        * decl.c (make_rtl_for_nonlocal_decl),
        (start_preparsed_function): Don't use lbasename on
        input_filename when calling get_fileinfo.
        * semantics.c (begin_class_definition): Likewise.
        * lex.c (cxx_make_type): Likewise.
        (handle_pragma_interface): Call get_fileinfo on input_filename,
        not on the parameter to the directive.

From-SVN: r116740
This commit is contained in:
Zak Kipling 2006-09-07 06:53:21 +00:00 committed by Jason Merrill
parent b5b84a7f46
commit c533e34d79
13 changed files with 80 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2006-09-06 Zak Kipling <zak@transversal.com>
PR c++/26195
* decl.c (make_rtl_for_nonlocal_decl),
(start_preparsed_function): Don't use lbasename on
input_filename when calling get_fileinfo.
* semantics.c (begin_class_definition): Likewise.
* lex.c (cxx_make_type): Likewise.
(handle_pragma_interface): Call get_fileinfo on input_filename,
not on the parameter to the directive.
2006-09-06 Mark Mitchell <mark@codesourcery.com>
PR c++/28903

View File

@ -4908,7 +4908,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
{
/* Fool with the linkage of static consts according to #pragma
interface. */
struct c_fileinfo *finfo = get_fileinfo (lbasename (filename));
struct c_fileinfo *finfo = get_fileinfo (filename);
if (!finfo->interface_unknown && !TREE_PUBLIC (decl))
{
TREE_PUBLIC (decl) = 1;
@ -10357,7 +10357,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
struct cp_binding_level *bl;
tree current_function_parms;
struct c_fileinfo *finfo
= get_fileinfo (lbasename (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1))));
= get_fileinfo (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1)));
bool honor_interface;
/* Sanity check. */

View File

@ -503,7 +503,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
else
filename = ggc_strdup (TREE_STRING_POINTER (fname));
finfo = get_fileinfo (filename);
finfo = get_fileinfo (input_filename);
if (impl_file_chain == 0)
{
@ -809,7 +809,7 @@ cxx_make_type (enum tree_code code)
/* Set up some flags that give proper default behavior. */
if (IS_AGGR_TYPE_CODE (code))
{
struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
struct c_fileinfo *finfo = get_fileinfo (input_filename);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}

View File

@ -2174,7 +2174,7 @@ begin_class_definition (tree t, tree attributes)
before. */
if (! TYPE_ANONYMOUS_P (t))
{
struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
struct c_fileinfo *finfo = get_fileinfo (input_filename);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X
(t, finfo->interface_unknown);

View File

@ -0,0 +1,7 @@
// PR c++/26195
// { dg-do link }
// { dg-additional-sources "interface2b.cc" }
// { dg-options "-fno-inline" }
#pragma implementation "interface2-imaginary.h"
#include "interface2a.h"

View File

@ -0,0 +1,5 @@
// PR c++/26195
#pragma interface "interface2-imaginary.h"
inline void foo1() { }
inline void foo2() { }

View File

@ -0,0 +1,9 @@
// PR c++/26195
extern void foo1();
extern void foo2();
int main()
{
foo1();
foo2();
}

View File

@ -0,0 +1,6 @@
// PR c++/26195
#pragma interface "dir1/interface3.h"
#include "../dir2/interface3.h"
inline void f1() { }
inline void f2() { }

View File

@ -0,0 +1,5 @@
// PR c++/26195
#pragma interface "dir2/interface3.h"
inline void g1() { }
inline void g2() { }

View File

@ -0,0 +1,7 @@
// PR c++/26195
// { dg-do link }
// { dg-additional-sources "interface3a2.cc" }
// { dg-options "-I. -fno-inline" }
#pragma implementation "dir1/interface3.cc"
#include "dir1/interface3.h"

View File

@ -0,0 +1,9 @@
// PR c++/26195
extern void f1();
extern void f2();
int main()
{
f1();
f2();
}

View File

@ -0,0 +1,7 @@
// PR c++/26195
// { dg-do link }
// { dg-additional-sources "interface3b2.cc" }
// { dg-options "-fno-inline" }
#pragma implementation "dir2/interface3.cc"
#include "dir1/interface3.h"

View File

@ -0,0 +1,9 @@
// PR c++/26195
extern void g1();
extern void g2();
int main()
{
g1();
g2();
}