Mail Archives: djgpp/2000/01/19/07:30:32
On 18 Jan 00, at 9:55, Eli Zaretskii wrote:
>
> On Mon, 17 Jan 2000, Andris Pavenis wrote:
>
> > Including $DJDIR/lib/../include/sys/version.h is a hack how to get
> > definitions of current DJGPP version automatically in. I still think
> > that best would be to force to include stdio.h when one needs version
> > definitions, but there were objections against such solution.
>
> The main objection is this: the ANSI Standard says that a program
> which doesn't include any header files should still have the same
> behavior as when it does.
I think such goal is not reachable. Examples:
code using macrodefinitions like FILENAME_MAX or code
explicitly using stdin, stdout or stderr (like fflush(stdout)).
Procedures returning value in floating point register etc.
DJGPP_MINOR isn't in ANSI standard (in difference from some
ot things I mentioned above). So I don't understand why it should
have higher priority.
>
> The best way to solve this nuisance would be to have some environment
> variable that specifies default command-line arguments for gcc or cpp.
> Then we could simply put -D__DJGPP__= there (in djgpp.env), and forget
> about this issue.
>
It was also said that removal such definition (DJGPP_MINOR at
compiler startup) should cause hard to debug problems. Here is simple
(and easy to use) rule that would force GCC to emit errors on such
problems (for us to be able to fix them):
Never define DJGPP_MINOR in application. For example,
don't include code like
#ifndef DJGPP_MINOR
#define DJGPP_MINOR 1
#endif
in code (or application's header files). I think there is no problems
to grep sources for violations of this rule. One can even write
simple script to automate this. After that there will be no problem
for GCC to emit errors when DJGPP_MINOR is not defined (when
one removes -imacros %s../include/sys/version.h hack from specs)
Andris
- Raw text -