This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fixincludes/C++ namespaces question(s)


Looking at stuff, I've just realized that this (fixincludes) fix might no longer
be needed, if we do things right.  I wanted to check with the C++ and
libstdc++-v3 people.

The reason I think that it may no longer be needed is namespaces.  C++ 
"exception" is in namespace "std::".  Math "struct exception" isn't, 
except if it's sucked in through the C++ compatibility header.  Which 
could deal with this on its own, if it cared to.  :-)

Or is it better just to leave this in fixincludes?

I'm also wondering about a very similar fix to "struct queue" defined in
"sys/stream.h" for certain SysV r4 systems.  Does the std:: namespace take
care of this conflict (in which case I can throw out the 'fix'), or not?
(In that case, I'm trying to convert the SysV r4 fixincludes to the standard
system, so *anything* I can throw out is good.)

-----
/*
 *  Some math.h files define struct exception (it's in the System V
 *  Interface Definition), which conflicts with
 *  the class exception defined in the C++ file std/stdexcept.h.  We
 *  redefine it to __math_exception.  This is not a great fix, but I
 *  haven't been able to think of anything better.
 *  Note that we have to put the #ifdef/#endif blocks at beginning
 *  and end of file, because fixproto runs after us and may insert
 *  additional references to struct exception.
 */
fix = {
    hackname  = math_exception;
    files     = math.h;
    select    = "struct exception";
    bypass    = '__cplusplus';
    c_fix     = wrap;

    c_fix_arg = "#ifdef __cplusplus\n"
                "#define exception __math_exception\n"
                "#endif\n";

    c_fix_arg = "#ifdef __cplusplus\n"
                "#undef exception\n"
                "#endif\n";

    test_text = "typedef struct exception t_math_exception;";
};


-- 
Nathanael Nerode  <neroden at gcc.gnu.org>
http://home.twcny.rr.com/nerode/neroden/fdl.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]