public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: How to suppress warning?
@ 2003-10-23 15:26 Lev Assinovsky
  2003-10-23 15:58 ` Eljay Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Lev Assinovsky @ 2003-10-23 15:26 UTC (permalink / raw)
  To: Eljay Love-Jensen, Gcc-Help (E-mail)

No, I work without eol (at the end of files) for years.
Just the warnings bother all of us.

----
Lev Assinovsky
Aelita Software Corporation
O&S InTrust Framework Division, Team Leader
ICQ# 165072909


> -----Original Message-----
> From: Eljay Love-Jensen [mailto:eljay@adobe.com]
> Sent: Thursday, October 23, 2003 7:21 PM
> To: Lev Assinovsky; Gcc-Help (E-mail)
> Subject: RE: How to suppress warning?
> 
> 
> Hi Lev,
> 
> Why I'm not surprised that the Windows' source files are 
> malformed.  :-)
> 
> If I'm not mistaken, the newline-at-eof is required.
> 
> Especially important for the preprocessor, such as a #endif 
> at the end of the file (since the preprocessor is less 
> forgiving), or when someone has a //-comment as the last line 
> in the file.
> 
> --Eljay
> 
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
  2003-10-23 15:26 How to suppress warning? Lev Assinovsky
@ 2003-10-23 15:58 ` Eljay Love-Jensen
  0 siblings, 0 replies; 11+ messages in thread
From: Eljay Love-Jensen @ 2003-10-23 15:58 UTC (permalink / raw)
  To: Lev Assinovsky, Gcc-Help (E-mail)

Hi Lev,

If you cannot make the source code comply with the language (due to the source code being out of your control, or whatnot), you can use perl to strip out the bothersome warnings from the compiler's output.

Other tools may provide similiar facility (awk, sed, python, ...).

--Eljay


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
  2003-10-23 17:30 ` Eljay Love-Jensen
@ 2003-10-24 10:18   ` Rupert Wood
  0 siblings, 0 replies; 11+ messages in thread
From: Rupert Wood @ 2003-10-24 10:18 UTC (permalink / raw)
  To: 'Lev Assinovsky'
  Cc: 'Eljay Love-Jensen', 'Gcc-Help (E-mail)'

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
  2003-10-23 15:28 lrtaylor
@ 2003-10-24 10:18 ` Rupert Wood
  0 siblings, 0 replies; 11+ messages in thread
From: Rupert Wood @ 2003-10-24 10:18 UTC (permalink / raw)
  To: lrtaylor; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

Lyle Taylor wrote: 

> Why is it that the preprocessor and compiler can't just be smart
> enough to handle it?

I think they do, they just warn anyway.

My quick test attached; looks fine on 2.95-3.4.

Rup.

[-- Attachment #2: teapot.c --]
[-- Type: text/plain, Size: 223 bytes --]

#include <stdio.h>

int main(void)
{
printf("I'm a little teapot\n");
#include "teapot.h"
printf("short and stout\n");
printf("here's my handle\n");
#include "teapot2.h"
printf("here's my spout\n");
return 0;
}

[-- Attachment #3: teapot.h --]
[-- Type: text/plain, Size: 47 bytes --]

//empty header, no newline at end of file

//

[-- Attachment #4: teapot2.h --]
[-- Type: text/plain, Size: 80 bytes --]

#ifndef _H_TEAPOT2
#define _H_TEAPOT2

// no newline at end of file

#endif

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
  2003-10-23 16:19 Lev Assinovsky
@ 2003-10-23 17:30 ` Eljay Love-Jensen
  2003-10-24 10:18   ` Rupert Wood
  0 siblings, 1 reply; 11+ messages in thread
From: Eljay Love-Jensen @ 2003-10-23 17:30 UTC (permalink / raw)
  To: Lev Assinovsky, Gcc-Help (E-mail)

Hi Lev,

>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.

I do not understand why post-processing the output from GCC to strip the warning that you want to ignore should stop your company.

Regardless of how many non-compliant source files you have in SourceSafe.

>So there is no option like "-Wno-noendofline" ?

Not to my knowledge.

--Eljay


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
@ 2003-10-23 16:19 Lev Assinovsky
  2003-10-23 17:30 ` Eljay Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Lev Assinovsky @ 2003-10-23 16:19 UTC (permalink / raw)
  To: Eljay Love-Jensen, Gcc-Help (E-mail)

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.
So there is no option like "-Wno-noendofline" ?

----
Lev Assinovsky
Aelita Software Corporation
O&S InTrust Framework Division, Team Leader
ICQ# 165072909


> -----Original Message-----
> From: Eljay Love-Jensen [mailto:eljay@adobe.com]
> Sent: Thursday, October 23, 2003 7:59 PM
> To: Lev Assinovsky; Gcc-Help (E-mail)
> Subject: RE: How to suppress warning?
> 
> 
> Hi Lev,
> 
> If you cannot make the source code comply with the language 
> (due to the source code being out of your control, or 
> whatnot), you can use perl to strip out the bothersome 
> warnings from the compiler's output.
> 
> Other tools may provide similiar facility (awk, sed, python, ...).
> 
> --Eljay
> 
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
@ 2003-10-23 15:28 lrtaylor
  2003-10-24 10:18 ` Rupert Wood
  0 siblings, 1 reply; 11+ messages in thread
From: lrtaylor @ 2003-10-23 15:28 UTC (permalink / raw)
  To: eljay, gcc-help

Why is it that the preprocessor and compiler can't just be smart enough
to handle it?  I might have expected something like this ten years ago,
but it surprises me that it's not smarter now.  Now, I'm sure it has to
do with complications in the parser, but still...

Lyle

-----Original Message-----
From: Eljay Love-Jensen [mailto:eljay@adobe.com] 
Sent: Thursday, October 23, 2003 9:21 AM
To: Lev Assinovsky; Gcc-Help (E-mail)
Subject: RE: How to suppress warning?

Hi Lev,

Why I'm not surprised that the Windows' source files are malformed.  :-)

If I'm not mistaken, the newline-at-eof is required.

Especially important for the preprocessor, such as a #endif at the end
of the file (since the preprocessor is less forgiving), or when someone
has a //-comment as the last line in the file.

--Eljay


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
  2003-10-23 14:32 Lev Assinovsky
@ 2003-10-23 15:19 ` Eljay Love-Jensen
  0 siblings, 0 replies; 11+ messages in thread
From: Eljay Love-Jensen @ 2003-10-23 15:19 UTC (permalink / raw)
  To: Lev Assinovsky, Gcc-Help (E-mail)

Hi Lev,

Why I'm not surprised that the Windows' source files are malformed.  :-)

If I'm not mistaken, the newline-at-eof is required.

Especially important for the preprocessor, such as a #endif at the end of the file (since the preprocessor is less forgiving), or when someone has a //-comment as the last line in the file.

--Eljay


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: How to suppress warning?
@ 2003-10-23 14:32 Lev Assinovsky
  2003-10-23 15:19 ` Eljay Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Lev Assinovsky @ 2003-10-23 14:32 UTC (permalink / raw)
  To: Eljay Love-Jensen, Gcc-Help (E-mail)

Sorry, but I am unable to modify the files.
They are coming from Windows.

----
Lev Assinovsky
Aelita Software Corporation
O&S InTrust Framework Division, Team Leader
ICQ# 165072909


> -----Original Message-----
> From: Eljay Love-Jensen [mailto:eljay@adobe.com]
> Sent: Thursday, October 23, 2003 5:41 PM
> To: Lev Assinovsky; Gcc-Help (E-mail)
> Subject: Re: How to suppress warning?
> 
> 
> Hi Lev,
> 
> >Does anybody knows how to suppress warning: "no newline at 
> end of file"
> 
> Put a newlineat the end of file.
> 
> (It's especially egregious not to have a newline at eof when 
> the last line is a preprocessor statement.)
> 
> HTH,
> --Eljay
> 
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to suppress warning?
  2003-10-23 13:26 Lev Assinovsky
@ 2003-10-23 13:40 ` Eljay Love-Jensen
  0 siblings, 0 replies; 11+ messages in thread
From: Eljay Love-Jensen @ 2003-10-23 13:40 UTC (permalink / raw)
  To: Lev Assinovsky, Gcc-Help (E-mail)

Hi Lev,

>Does anybody knows how to suppress warning: "no newline at end of file"

Put a newlineat the end of file.

(It's especially egregious not to have a newline at eof when the last line is a preprocessor statement.)

HTH,
--Eljay


^ permalink raw reply	[flat|nested] 11+ messages in thread

* How to suppress warning?
@ 2003-10-23 13:26 Lev Assinovsky
  2003-10-23 13:40 ` Eljay Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Lev Assinovsky @ 2003-10-23 13:26 UTC (permalink / raw)
  To: Gcc-Help (E-mail)

Hello folks!
Does anybody knows how to suppress warning:
"no newline at end of file"

Thanks in advance.

----
Lev Assinovsky
Aelita Software Corporation
O&S InTrust Framework Division, Team Leader
ICQ# 165072909

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-10-24 10:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-23 15:26 How to suppress warning? Lev Assinovsky
2003-10-23 15:58 ` Eljay Love-Jensen
  -- strict thread matches above, loose matches on Subject: below --
2003-10-23 16:19 Lev Assinovsky
2003-10-23 17:30 ` Eljay Love-Jensen
2003-10-24 10:18   ` Rupert Wood
2003-10-23 15:28 lrtaylor
2003-10-24 10:18 ` Rupert Wood
2003-10-23 14:32 Lev Assinovsky
2003-10-23 15:19 ` Eljay Love-Jensen
2003-10-23 13:26 Lev Assinovsky
2003-10-23 13:40 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).