1fcb515536
Partial fix for PR c++/827. * cp-support.h: Include symtab.h. Declare cp_lookup_symbol_nonlocal, cp_lookup_symbol_namespace. * cp-namespace.c: Update contributors. (cp_lookup_symbol_nonlocal): New. (lookup_namespace_scope, cp_lookup_symbol_namespace) (lookup_symbol_file): Ditto. * c-lang.c (cplus_language_defn): Use cp_lookup_symbol_nonlocal. * block.h: Declare block_scope, block_using, block_global_block. * block.c (block_scope): New. (block_using, block_global_block): Ditto. * Makefile.in (cp_support_h): Depend on symtab_h. * config/djgpp/fnchange.lst: Add testsuite/gdb.c++/namespace1.cc. 2003-05-19 David Carlton <carlton@bactrian.org> * gdb.c++/namespace.exp: Add namespace scope and anonymous namespace tests. Bump copyright date. * gdb.c++/namespace.cc: Add anonymous namespace and namespace C. (main): Call C::D::marker2. * gdb.c++/namespace1.cc: New file.
163 lines
1.8 KiB
C++
163 lines
1.8 KiB
C++
namespace AAA {
|
|
char c;
|
|
int i;
|
|
int A_xyzq (int);
|
|
char xyzq (char);
|
|
class inA {
|
|
public:
|
|
int xx;
|
|
int fum (int);
|
|
};
|
|
};
|
|
|
|
int AAA::inA::fum (int i)
|
|
{
|
|
return 10 + i;
|
|
}
|
|
|
|
namespace BBB {
|
|
char c;
|
|
int i;
|
|
int B_xyzq (int);
|
|
char xyzq (char);
|
|
|
|
namespace CCC {
|
|
char xyzq (char);
|
|
};
|
|
|
|
class Class {
|
|
public:
|
|
char xyzq (char);
|
|
int dummy;
|
|
};
|
|
};
|
|
|
|
int AAA::A_xyzq (int x)
|
|
{
|
|
return 2 * x;
|
|
}
|
|
|
|
char AAA::xyzq (char c)
|
|
{
|
|
return 'a';
|
|
}
|
|
|
|
|
|
int BBB::B_xyzq (int x)
|
|
{
|
|
return 3 * x;
|
|
}
|
|
|
|
char BBB::xyzq (char c)
|
|
{
|
|
return 'b';
|
|
}
|
|
|
|
char BBB::CCC::xyzq (char c)
|
|
{
|
|
return 'z';
|
|
}
|
|
|
|
char BBB::Class::xyzq (char c)
|
|
{
|
|
return 'o';
|
|
}
|
|
|
|
void marker1(void)
|
|
{
|
|
return;
|
|
}
|
|
|
|
namespace
|
|
{
|
|
int X = 9;
|
|
|
|
namespace G
|
|
{
|
|
int Xg = 10;
|
|
}
|
|
}
|
|
|
|
namespace C
|
|
{
|
|
int c = 1;
|
|
int shadow = 12;
|
|
|
|
namespace
|
|
{
|
|
int cX = 6;
|
|
|
|
namespace F
|
|
{
|
|
int cXf = 7;
|
|
}
|
|
}
|
|
|
|
namespace C
|
|
{
|
|
int cc = 2;
|
|
}
|
|
|
|
namespace D
|
|
{
|
|
int cd = 3;
|
|
int shadow = 13;
|
|
|
|
namespace E
|
|
{
|
|
int cde = 5;
|
|
}
|
|
|
|
void marker2 (void)
|
|
{
|
|
// NOTE: carlton/2003-04-23: I'm listing the expressions that I
|
|
// plan to have GDB try to print out, just to make sure that the
|
|
// compiler and I agree which ones should be legal! It's easy
|
|
// to screw up when testing the boundaries of namespace stuff.
|
|
c;
|
|
//cc;
|
|
C::cc;
|
|
cd;
|
|
E::cde;
|
|
shadow;
|
|
cX;
|
|
F::cXf;
|
|
X;
|
|
G::Xg;
|
|
//cXOtherFile;
|
|
//XOtherFile;
|
|
|
|
return;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
int main ()
|
|
{
|
|
using AAA::inA;
|
|
char c1;
|
|
|
|
using namespace BBB;
|
|
|
|
c1 = xyzq ('x');
|
|
c1 = AAA::xyzq ('x');
|
|
c1 = BBB::CCC::xyzq ('m');
|
|
|
|
inA ina;
|
|
|
|
ina.xx = 33;
|
|
|
|
int y;
|
|
|
|
y = AAA::A_xyzq (33);
|
|
y += B_xyzq (44);
|
|
|
|
BBB::Class cl;
|
|
|
|
c1 = cl.xyzq('e');
|
|
|
|
marker1();
|
|
|
|
C::D::marker2 ();
|
|
}
|