From: "Alexandre Devaure" Newsgroups: comp.os.msdos.djgpp References: <8dk3aa$m6a$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Subject: Re: 'volatile' undeclared from here Lines: 145 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: <9LgL4.1906$D21.3649551@nnrp4.proxad.net> Date: Wed, 19 Apr 2000 11:28:05 GMT NNTP-Posting-Host: 194.51.236.59 X-Complaints-To: abuse AT proxad DOT net X-Trace: nnrp4.proxad.net 956143685 194.51.236.59 (Wed, 19 Apr 2000 13:28:05 CEST) NNTP-Posting-Date: Wed, 19 Apr 2000 13:28:05 CEST Organization: Guest of ProXad - France To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker a écrit dans le message : 8dk3aa$m6a$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > Please show more details. Minimal source code, gcc command line (with > '-v' added, and the actual compiler output, in full text. Here it is The source code : template class TValueFifo { private: unsigned Head; unsigned Tail; unsigned Count; unsigned char Buffer[Size*sizeof(T)]; public: int Empty() { return !Count; } int Full() { return Count==Size; } int Put(const T& Value) { if (!Full()) { ((T*)Buffer)[Head]= Value; if (Head>=Size-1) Head=0; else Head++; Count++; return 0; } return 1; } int PutSecure(const T& Value) { asm volatile ("pushf"); <= the problem is here disable(); int Error = Put(Value); popf(); return Error; } void Get(T& Value) { Value= ((T*)Buffer)[Tail]; if (Tail>=Size-1) Tail=0; else Tail++; Count--; } T Get() { T Value; Get(Value); return Value; } TValueFifo() : Head(0), Tail(0), Count(0) {} }; the gcc output: gcc -v -c taskmgr.cpp -I. Reading specs from c:/usr/lib/specs gcc version 2.95.2 19991024 (release) c:/usr/lib/gcc-lib/djgpp/2.952/cpp.exe -lang-c++ -v -I. -isystem c:/usr/bin/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cpluspl us -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=2 -D__unix__ -D__i38 6__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=2 -D__unix -D__i3 86 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=2 -D__EXCEPTIONS taskmgr.cpp C:\windows\TEMP\cc6RbN8i.ii GNU CPP version 2.95.2 19991024 (release) (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: . c:/usr/lang/cxx c:/usr/include c:/usr/lang/cxx c:/usr/lib/gcc-lib/djgpp/2.952/include c:/usr/include End of search list. The following default directories have been omitted from the search path: $DJDIR/lib/gcc-lib/djgpp/2.952/../../../../djgpp/include End of omitted list. c:/usr/lib/gcc-lib/djgpp/2.952/cc1plus.exe C:\windows\TEMP\cc6RbN8i.ii -m486 -malign-jumps=2 -malign-loops=2 -malign-fu nctions=2 -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -quiet - dumpbase taskmgr.cc -version -o C:\windows\TEMP\ccx1hBjr.s GNU C++ version 2.95.2 19991024 (release) (djgpp) compiled by GNU C version 2.95.2 19991024 (release). In file included from taskmgr.cpp:17: taskmgr.h: In function `int Task_StateCriticalSection()': taskmgr.h:205: warning: negative value `-1' passed as argument 1 of `Task_CriticalSection(unsigned char)' taskmgr.cpp: In function `int Task_CriticalSectionState(...)': taskmgr.cpp:241: warning: negative value `-1' passed as argument 1 of `Task_CriticalSection(unsigned char)' taskmgr.cpp: In function `union TIntStack * TaskHandlerProc(TIntStack *, int)': taskmgr.cpp:335: warning: negative value `-1' passed as argument 1 of `Task_CriticalSection(unsigned char)' taskmgr.cpp:363: warning: left shift count >= width of type taskmgr.cpp:370: warning: assignment of negative value `-1' to `short unsigned int' tfifo.h: In method `int TValueFifo::PutSecure(const STaskMessage &)': taskmgr.cpp:542: instantiated from here tfifo.h:35: `volatile' undeclared (first use this function) tfifo.h:35: (Each undeclared identifier is reported only once tfifo.h:35: for each function it appears in.) tfifo.h:35: warning: qualifier ignored on asm taskmgr.cpp:542: instantiated from here tfifo.h:38: warning: qualifier ignored on asm taskmgr.cpp: In function `void TaskTimebase()': taskmgr.cpp:579: ANSI C++ forbids declaration `TimeAccu' with no type taskmgr.cpp: In function `int Task_Create(void (*)(), short unsigned int, void * = 0, short unsigned int, unsigned char = 0)': taskmgr.cpp:717: implicit declaration of function `int memset(...)' taskmgr.cpp:748: implicit declaration of function `int max(...)' taskmgr.cpp:748: implicit declaration of function `int _fmemset(...)' taskmgr.cpp:787: implicit declaration of function `int min(...)' taskmgr.cpp:800: name lookup of `PriorityDescIndex' changed for new ANSI `for' scoping taskmgr.cpp:797: using obsolete binding at `PriorityDescIndex' taskmgr.cpp:805: implicit declaration of function `int memmove(...)' taskmgr.cpp:823: name lookup of `TaskVsPriorityIndex' changed for new ANSI `for' scoping taskmgr.cpp:820: using obsolete binding at `TaskVsPriorityIndex' taskmgr.cpp:832: implicit declaration of function `int FP_SEG(...)' taskmgr.cpp:836: implicit declaration of function `int MK_FP(...)' taskmgr.cpp:836: implicit declaration of function `int _fmemcpy(...)' taskmgr.cpp: In function `void TaskStartUp()': taskmgr.cpp:1028: implicit declaration of function `int getvect(...)' taskmgr.cpp:1028: assignment to `void (*)(...)' from `int' lacks a cast taskmgr.cpp:1029: implicit declaration of function `int setvect(...)' taskmgr.cpp:1035: assignment to `void (*)(...)' from `int' lacks a cast