How to suppress warning?

Rupert Wood me@rupey.net
Fri Oct 24 10:18:00 GMT 2003


Eljay / Lev wrote: 

> > Sorry, but we have tons of files in SourceSafe. To do what you
> > suggest I have to stop our company for few hours, which is
> > impossible.

Then work early, work late or work a weekend :-) But I don't think it's
worth fixing: they'd slowly rot away since Windows editors don't care about
EOFs at the end of the file.

If you can convince everyone to working with 'view whitespace', though, ...
:-)

> >So there is no option like "-Wno-noendofline" ?
> Not to my knowledge.

I don't think there's a unix sourcesafe client, is there? (I guess
SourceOffSite may have one, I've never seen it.) That means you have to
check out on Windows and then copy over to unix? When I used to work with
unix and sourcesafe I wrote a few scripts to include line ending conversion
and the newline at end of file conversion at the same time as the copy. If
you edit on unix and copy back, you get the newline-at-end-of-file and any
stray LFs in sourcesafe fixed up for you; yeah, it's an unnecssary diff but
it's not a great deal as these things go.

As Eljay suggests you can strip the warning with unix tools. You could do
this on the compile line (I'm not sure I have the magic shell knowledge,
though; someething like:

    gcc foo.c 2|grep -v "no newline"

? I've never piped stderr before) or edit that into the compile rules in
your makefile  - but this means you can't use -Werror and maybe -pedantic
too. But if you're just inspecting a build log afterwards it's quite easy,
e.g.

    gmake &> build.log
    grep -v "no newline" <build.log >build2.log

Or, if you're comfortable building your own GCC it'd be easy enough to stop
the warning there. Look in gcc/cpplex.c. There's no flag test where the
warning's generated so you're right, there's no flag already to suppress
this. You could, of course, add one and submit a patch - shouldn't be too
hard :-)

Good luck,
Rup.



More information about the Gcc-help mailing list