9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] x11-init.c
@ 2004-06-22 22:33 Rob 'Commander' Pike
  2004-06-23  1:23 ` Scott Schwartz
  2004-06-23 19:07 ` William Josephson
  0 siblings, 2 replies; 8+ messages in thread
From: Rob 'Commander' Pike @ 2004-06-22 22:33 UTC (permalink / raw)
  To: 9fans

russ is unreachable so i thought i'd just pass this info along here.
in the new plan9port update, x11-init.c:352 is missing an argument
to the smprint statement. the correct line is:
			if(home!=nil && (file=smprint("%s/.Xdefaults", home)) != nil){
on some machines this causes disastrous failure unless fixed.
-rob



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

* Re: [9fans] x11-init.c
  2004-06-22 22:33 [9fans] x11-init.c Rob 'Commander' Pike
@ 2004-06-23  1:23 ` Scott Schwartz
  2004-06-23  5:02   ` Charles Forsyth
                     ` (2 more replies)
  2004-06-23 19:07 ` William Josephson
  1 sibling, 3 replies; 8+ messages in thread
From: Scott Schwartz @ 2004-06-23  1:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

| in the new plan9port update, x11-init.c:352 is missing an argument
| to the smprint statement. the correct line is:

Gcc has a way to tell the compiler to check printf like varargs functions.
Given the impact, maybe the ports should use that, at the cost of some ifdefs.


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

* Re: [9fans] x11-init.c
  2004-06-23  1:23 ` Scott Schwartz
@ 2004-06-23  5:02   ` Charles Forsyth
  2004-06-23 10:18     ` boyd, rounin
  2004-06-23  8:47   ` Bengt Kleberg
  2004-06-23 19:05   ` William Josephson
  2 siblings, 1 reply; 8+ messages in thread
From: Charles Forsyth @ 2004-06-23  5:02 UTC (permalink / raw)
  To: 9fans

>>Gcc has a way to tell the compiler to check printf like varargs functions.

i was fairly sure, last time i looked at it, that gcc `knew' what printf format
letters were, including of course gcc's own extensions, in contrast
to the ken C varargck pragmas that allow one to tell the compiler what they are,
which helpfully works with fmtinstall.

i'll look again ... doesn't gcc (it claims to be 3.3) know a lot:
wc -l c-format.c
    2360 c-format.c



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

* Re: [9fans] x11-init.c
  2004-06-23  1:23 ` Scott Schwartz
  2004-06-23  5:02   ` Charles Forsyth
@ 2004-06-23  8:47   ` Bengt Kleberg
  2004-06-23  9:07     ` Charles Forsyth
  2004-06-23 19:05   ` William Josephson
  2 siblings, 1 reply; 8+ messages in thread
From: Bengt Kleberg @ 2004-06-23  8:47 UTC (permalink / raw)
  To: 9fans

Scott Schwartz wrote:
...deleted
> Gcc has a way to tell the compiler to check printf like varargs functions.
> Given the impact, maybe the ports should use that, at the cost of some ifdefs.

i hope this means that gcc should get some additional flags. it would be 
unfortunate if it means that the ports should be made dependent upon gcc.


bengt


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

* Re: [9fans] x11-init.c
  2004-06-23  8:47   ` Bengt Kleberg
@ 2004-06-23  9:07     ` Charles Forsyth
  0 siblings, 0 replies; 8+ messages in thread
From: Charles Forsyth @ 2004-06-23  9:07 UTC (permalink / raw)
  To: 9fans

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

gcc enables the warnings with -Wformat, but the association between
varargs function and format checking is done by the following (on FreeBSD):

int	 asprintf __P((char **, const char *, ...)) __printflike(2, 3);

where

#define	__printflike(fmtarg, firstvararg) \
	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))


it's the __attribute__ cluster that's built-in to gcc.
Linux uses different #defines but the result is similar.
hence the need for ifdefs somewhere to avoid feeding __stuff__ to other compilers.
(there are many many more __things__.)
the list of formats is also built-in to the compiler.
it doesn't look as though it can easily be extended, but i have waded
through neither code nor spent time down by the docs.

Plan 9's compilers use a pragma to allow sets of format types
and flags to be defined outside the compiler, in a way that doesn't
give other compilers heartburn,
and thus without absolutely requiring ifdefs.  to be fair, the current
implementation assumes all flags (in the current scope) have the same meaning,
and does define a handful of built-in flags such as '.' (although neither restriction
is essential); 375 lines.

[-- Attachment #2: Type: message/rfc822, Size: 2790 bytes --]

From: Bengt Kleberg <bengt.kleberg@ericsson.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] x11-init.c
Date: Wed, 23 Jun 2004 08:47:20 GMT
Message-ID: <cbbe27$co0$1@newstree.wise.edt.ericsson.se>

Scott Schwartz wrote:
...deleted
> Gcc has a way to tell the compiler to check printf like varargs functions.
> Given the impact, maybe the ports should use that, at the cost of some ifdefs.

i hope this means that gcc should get some additional flags. it would be 
unfortunate if it means that the ports should be made dependent upon gcc.


bengt

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

* Re: [9fans] x11-init.c
  2004-06-23  5:02   ` Charles Forsyth
@ 2004-06-23 10:18     ` boyd, rounin
  0 siblings, 0 replies; 8+ messages in thread
From: boyd, rounin @ 2004-06-23 10:18 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> i'll look again ... doesn't gcc (it claims to be 3.3) know a lot:
> wc -l c-format.c
>     2360 c-format.c

it would, wouldn't it?  who knows how much more code
would be required to grok installable formats?



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

* Re: [9fans] x11-init.c
  2004-06-23  1:23 ` Scott Schwartz
  2004-06-23  5:02   ` Charles Forsyth
  2004-06-23  8:47   ` Bengt Kleberg
@ 2004-06-23 19:05   ` William Josephson
  2 siblings, 0 replies; 8+ messages in thread
From: William Josephson @ 2004-06-23 19:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, Jun 22, 2004 at 09:23:17PM -0400, Scott Schwartz wrote:
> | in the new plan9port update, x11-init.c:352 is missing an argument
> | to the smprint statement. the correct line is:
> 
> Gcc has a way to tell the compiler to check printf like varargs functions.
> Given the impact, maybe the ports should use that, at the cost of some ifdefs.

Gcc does not have a general mechanism for this,
unlike Ken's compiler.  And I think switching
from print to printf simply isn't practical.


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

* Re: [9fans] x11-init.c
  2004-06-22 22:33 [9fans] x11-init.c Rob 'Commander' Pike
  2004-06-23  1:23 ` Scott Schwartz
@ 2004-06-23 19:07 ` William Josephson
  1 sibling, 0 replies; 8+ messages in thread
From: William Josephson @ 2004-06-23 19:07 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, Jun 22, 2004 at 03:33:37PM -0700, Rob 'Commander' Pike wrote:
> russ is unreachable so i thought i'd just pass this info along here.
> in the new plan9port update, x11-init.c:352 is missing an argument
> to the smprint statement. the correct line is:
> 			if(home!=nil && (file=smprint("%s/.Xdefaults", 
> 			home)) != nil){
> on some machines this causes disastrous failure unless fixed.

While Russ is away, I'll accept bug fixes (only) and
commit them to the CVS repository.

 -WJ

p.s. Rotate my username appropriately to send me mail.


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

end of thread, other threads:[~2004-06-23 19:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 22:33 [9fans] x11-init.c Rob 'Commander' Pike
2004-06-23  1:23 ` Scott Schwartz
2004-06-23  5:02   ` Charles Forsyth
2004-06-23 10:18     ` boyd, rounin
2004-06-23  8:47   ` Bengt Kleberg
2004-06-23  9:07     ` Charles Forsyth
2004-06-23 19:05   ` William Josephson
2004-06-23 19:07 ` William Josephson

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 NNTP newsgroup(s).