[Wave] injecting standard headers directly, without a file

[Did I already suggest something like this?...] The Wave preprocessing tool can accept locations for a compiler's system header files. I think the C++ standard allows the standard headers to not be implemented as conventional files. I'm wondering if we can do that, as an experiment. In other words, the Wave library could have an option to inject our version of idealized renditions of the standard headers directly into the token stream, without referencing actual header files. This could catch bugs that assume certain things about actual header files that wouldn't be present in our version. Our standard headers could be in the form of a collection of functions, one for each compiler item (function, type, object, template, macro, etc.). Those functions would be passed in a level of expression (declaration in a secret __boost_std namespace, injection of declaration into the std namespace, full definition in __boost_std namespace [or no namespace for macros]) and a descriptor of the environment (bits per byte, bytes per short/int/long, 2/1-complement or sign-mag, etc.). An inclusion function for each header would call the inclusion functions for each contained item, but only up to the lowest level required. Items originally from other headers would get included if needed, but without injection into std if avoidable. (For instance, #including <iostream> would _not_ get you <istream> and <ostream> for free!) -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com

Daryle,
[Did I already suggest something like this?...]
The Wave preprocessing tool can accept locations for a compiler's system header files. I think the C++ standard allows the standard headers to not be implemented as conventional files. I'm wondering if we can do that, as an experiment. In other words, the Wave library could have an option to inject our version of idealized renditions of the standard headers directly into the token stream, without referencing actual header files. This could catch bugs that assume certain things about actual header files that wouldn't be present in our version.
This sounds - hmmm - interesting.
Our standard headers could be in the form of a collection of functions, one for each compiler item (function, type, object, template, macro, etc.). Those functions would be passed in a level of expression (declaration in a secret __boost_std namespace, injection of declaration into the std namespace, full definition in __boost_std namespace [or no namespace for macros]) and a descriptor of the environment (bits per byte, bytes per short/int/long, 2/1-complement or sign-mag, etc.). An inclusion function for each header would call the inclusion functions for each contained item, but only up to the lowest level required.
Could elaborate, please? Somewhere midsentence you lost me here. Can you give an example, how you envision this? Regards Hartmut

Daryle Walker wrote:
[Did I already suggest something like this?...]
The Wave preprocessing tool can accept locations for a compiler's system header files. I think the C++ standard allows the standard headers to not be implemented as conventional files. I'm wondering if we can do that, as an experiment. In other words, the Wave library could have an option to inject our version of idealized renditions of the standard headers directly into the token stream, without referencing actual header files. This could catch bugs that assume certain things about actual header files that wouldn't be present in our version.
While that would certainly work in theory, I don't think this is a very practical trick: you'd have to rewrite a huge amount of code (the standard library is big !), and the result would really only be useful to catch the kind of 'bugs' you are talking about. You wouldn't be able to actually do much with the code (such as compile it), as each compiler does in fact have its own version of standard (and not so standard) headers. Regards, Stefan -- ...ich hab' noch einen Koffer in Berlin...
participants (3)
-
Daryle Walker
-
Hartmut Kaiser
-
Stefan Seefeld