Mail Archives: djgpp/2000/01/19/11:48:20
On 19 Jan 00, at 11:49, Eli Zaretskii wrote:
>
> On Wed, 19 Jan 2000 pavenis AT lanet DOT lv wrote:
>
> > > 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.
>
> Perhaps not in 100%, but it doesn't mean we shouldn't try.
>
> > 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):
>
> The case was with programs that were ported *before* v2.03. What you
> suggest is reasonable, but it doesn't help for old code.
We'll here is sample of very simple script that detects such definitions that should be
avoided:
#! /bin/sh
for file in `cat manifest/$1`; do
case $file in *.c|*.cc|*.h|*.C)
cat $file | \
awk '$1=="#define" && $2=="DJGPP_MINOR" {found=1} END {exit found}' ||\
echo $file ;;
esac;
done
It works for DJGPP packages which have .mft files, but it's simple to modify it
to scan a directory tree instead (tested: script found include/sys/version.h
in djdev203 as it should). After removal of explicit #define DJGPP_MINOR and
#undef DJGPP_MINOR in user code (and header files) the remaining work will
be done by GCC.
Of course it would be complicated for novices, but I think novices are likely
not to use definition of DJGPP_MINOR anyway.
Andris
- Raw text -