From owner-freebsd-hackers Tue Feb 5 14:43: 3 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from renown.cnchost.com (renown.concentric.net [207.155.248.7]) by hub.freebsd.org (Postfix) with ESMTP id E249E37B422 for ; Tue, 5 Feb 2002 14:42:56 -0800 (PST) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by renown.cnchost.com id RAA05212; Tue, 5 Feb 2002 17:42:45 -0500 (EST) [ConcentricHost SMTP Relay 1.14] Message-ID: <200202052242.RAA05212@renown.cnchost.com> To: Poul-Henning Kamp Cc: John Polstra , hackers@freebsd.org Subject: Re: A question about timecounters In-reply-to: Your message of "Tue, 05 Feb 2002 20:52:11 +0100." <92661.1012938731@critter.freebsd.dk> Date: Tue, 05 Feb 2002 14:42:38 -0800 From: Bakul Shah Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Btw, regarding the volatile thing: > > If I do > extern volatile struct timecounter *timecounter; > > microtime() > { > struct timecounter *tc; > > tc = timecounter; > > The compiler complains about loosing the volatile thing. > > How do I tell it that it is the contents of the "timecounter" pointer which > is volatile, but now what it points at ? I don't want the "tc" pointer to > be volatile because it obviously isn't. Do I really need to cast it ? > > tc = (struct timecounter *)timecounter; [I see that jdp has answered your question but] cdecl is your friend! $ cdecl Type `help' or `?' for help cdecl> explain volatile struct timecounter *timecounter declare timecounter as pointer to volatile struct timecounter cdecl> declare timecounter as volatile pointer to struct timecounter struct timecounter * volatile timecounter -- bakul PS: Chances are most people don't have cdecl any more. You can get it like this: mkdir cdecl;cd cdecl fetch ftp://gatekeeper.dec.com/pub/usenet/comp.sources.unix/volume14/cdecl2/part0{1,2}.Z gzcat part01.Z | gunshar gzcat part02.Z | gunshar patch <<'EOF' diff -ru ../cdecl-orig/cdecl.c ./cdecl.c --- ../cdecl-orig/cdecl.c Tue Feb 5 14:24:23 2002 +++ ./cdecl.c Tue Feb 5 12:12:30 2002 @@ -57,6 +57,9 @@ # include # include # include +#ifdef BSD +#include +#endif #else # ifndef NOVARARGS # include @@ -110,6 +113,9 @@ void docast(char*, char*, char*, char*); void dodexplain(char*, char*, char*, char*); void docexplain(char*, char*, char*, char*); +#ifdef __FreeBSD__ +#define setprogname _bad_bad_bad_FreeBSD +#endif void setprogname(char *); int dotmpfile(int, char**), dofileargs(int, char**); #else diff -ru ../cdecl-orig/makefile ./makefile --- ../cdecl-orig/makefile Tue Feb 5 14:24:19 2002 +++ ./makefile Tue Feb 5 12:10:10 2002 @@ -13,7 +13,7 @@ # add -Ddodebug To compile in debugging trace statements. # add -Ddoyydebug To compile in yacc trace statements. -CFLAGS= -g -Ddodebug -Ddoyydebug +CFLAGS= -g -Ddodebug -Ddoyydebug -DBSD CC= cc ALLFILES= makefile cdgram.y cdlex.l cdecl.c cdecl.1 testset testset++ BIN= /usr/lubin EOF make # as root: make install BIN=/usr/local/bin No idea if c++decl is valid any more! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message