weird error messages from __COPYRIGHT macro

2000-08-16 Thread Sheldon Hearn


Here is a source file which looks fine to me, but for which I get
unexpected assembler warnings:

#include sys/cdefs.h

__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n"
"The Regents of the University of California."
"  All rights reserved.\n");

int
main(void)
{

exit(0);
}

The compiler warnings follow:

/tmp/ccZ16701.s: Assembler messages:
/tmp/ccZ16701.s:5: Warning: Unterminated string: Newline inserted.
/tmp/ccZ16701.s:6: Warning: Unterminated string: Newline inserted.

I'm led to believe that these error messages are not present on a NetBSD
box.  So is this broken usage of __COPYRIGHT(), or is this pre-processor
or assembler breakage?

And please don't whine about me about string concatenation -- it's legal
in ANSI C. :-)

Thanks,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Sheldon Hearn



On Wed, 16 Aug 2000 22:09:02 +0200, Mark Murray wrote:

 Maybe I am.
 
 Did your _exact_ sample program fail on NetBSD in the same way that
 it failed on FreeBSD?

No.  A sufficiently similar program also fails on FreeBSD but does not
fail on NetBSD. :-)

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Sheldon Hearn



On Wed, 16 Aug 2000 21:58:11 +0200, Mark Murray wrote:

 Bah.
 
 Only three things use __COPYRIGHT; ftp(d?), routed and make. None of them
 use \n's like you do.

I'm not trying to protect the way I do it, since I don't use the macro
myself.  I just want to make sure that, if the NetBSD behaviour
(handling embedded newlines properly) is correct, that we provide a
compatible interface.

Am I missing something here?

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Sheldon Hearn



On Wed, 16 Aug 2000 21:25:14 +0200, Mark Murray wrote:

 ...and it does not like the multi-line string. You may need to
 double-escape the \n's (like \\n) to get them into the .ident
 line symbolically.
 
 (I just checked - it worked!)

Now we just need someone with a NetBSD box handy to let us know whether
double-escaping the newlines works alright there.  I have a feeling
it won't, which probably means we need to see if we can fix our
implementation of __IDSTRING().

I've sent private mail to Peter, who introduced this implementation of
__IDSTRING in rev 1.26 of cdefs.h.

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Mark Murray

 I'm not trying to protect the way I do it, since I don't use the macro
 myself.  I just want to make sure that, if the NetBSD behaviour
 (handling embedded newlines properly) is correct, that we provide a
 compatible interface.
 
 Am I missing something here?

Maybe I am.

Did your _exact_ sample program fail on NetBSD in the same way that
it failed on FreeBSD?

M
--
Mark Murray
Join the anti-SPAM movement: http://www.cauce.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Mark Murray

  (I just checked - it worked!)
 
 Now we just need someone with a NetBSD box handy to let us know whether
 double-escaping the newlines works alright there.  I have a feeling
 it won't, which probably means we need to see if we can fix our
 implementation of __IDSTRING().

Bah.

Only three things use __COPYRIGHT; ftp(d?), routed and make. None of them
use \n's like you do.

 I've sent private mail to Peter, who introduced this implementation of
 __IDSTRING in rev 1.26 of cdefs.h.

Compatibility measure?

M
--
Mark Murray
Join the anti-SPAM movement: http://www.cauce.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: weird error messages from __COPYRIGHT macro

2000-08-16 Thread Mark Murray

 And please don't whine about me about string concatenation -- it's legal
 in ANSI C. :-)

__COPYRIGHT is defined as

#define __COPYRIGHT(s)  __IDSTRING(copyright,s)

and __IDSTRING is

#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")

By the time the string makes it to the assembler, the \n's have been
turned into (real) NL's so the assembler line looks like

.ident  "@(#) Copyright (c) 1983, 1988, 1993
The Regents of the University of California.  All rights reserved.
"
...and it does not like the multi-line string. You may need to
double-escape the \n's (like \\n) to get them into the .ident
line symbolically.

(I just checked - it worked!)

M
--
Mark Murray
Join the anti-SPAM movement: http://www.cauce.org


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message