Date: Tue, 05 Feb 2002 14:42:38 -0800 From: Bakul Shah <bakul@bitblocks.com> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: John Polstra <jdp@polstra.com>, hackers@freebsd.org Subject: Re: A question about timecounters Message-ID: <200202052242.RAA05212@renown.cnchost.com> In-Reply-To: Your message of "Tue, 05 Feb 2002 20:52:11 %2B0100." <92661.1012938731@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <stddef.h>
# include <string.h>
# include <stdarg.h>
+#ifdef BSD
+#include <errno.h>
+#endif
#else
# ifndef NOVARARGS
# include <varargs.h>
@@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202052242.RAA05212>
