From: "Alexandre Devaure" Newsgroups: comp.os.msdos.djgpp References: <8dk3aa$m6a$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <9LgL4.1906$D21 DOT 3649551 AT nnrp4 DOT proxad DOT net> <8dkfaj$rk1$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8dkh60$sjr$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8dml61$9co$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Subject: Re: 'volatile' undeclared from here Lines: 420 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: Date: Thu, 20 Apr 2000 11:37:03 GMT NNTP-Posting-Host: 194.51.236.59 X-Complaints-To: abuse AT proxad DOT net X-Trace: nnrp6.proxad.net 956230623 194.51.236.59 (Thu, 20 Apr 2000 13:37:03 CEST) NNTP-Posting-Date: Thu, 20 Apr 2000 13:37:03 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 : 8dml61$9co$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > Alexandre Devaure wrote: > > >> Could you try and cut down the source to the absolute minimum that > >> still reports that compiler error, and post the result? > > > This is the source code that reports the compiler error. It seems to be a > > problem with the template in the class TValueFifo. When I comment out the > > template declaration, the compiler accepts the source code. > > Well, seems I didn't quite make clear what we need to reproduce the > bug. Your code uses header files, which you didn't show. We'll either > need the fully preprocessed code ('gcc -E' output), or a copy of your > used header files: > > > #include "ports.h" > > #include here is the output of gcc -E : # 1 "tst.cpp" # 1 "ports.h" 1 # 32 "ports.h" # 44 "ports.h" # 1 "tst.cpp" 2 # 1 "c:/usr/include/stdio.h" 1 3 extern "C" { # 1 "c:/usr/include/sys/version.h" 1 3 # 13 "c:/usr/include/stdio.h" 2 3 # 1 "c:/usr/include/sys/djtypes.h" 1 3 # 14 "c:/usr/include/stdio.h" 2 3 typedef void *va_list; typedef long unsigned int size_t; typedef struct { int _cnt; char *_ptr; char *_base; int _bufsiz; int _flag; int _file; char *_name_to_remove; int _fillsize; } FILE; typedef unsigned long fpos_t; extern FILE __dj_stdin, __dj_stdout, __dj_stderr; void clearerr(FILE *_stream); int fclose(FILE *_stream); int feof(FILE *_stream); int ferror(FILE *_stream); int fflush(FILE *_stream); int fgetc(FILE *_stream); int fgetpos(FILE *_stream, fpos_t *_pos); char * fgets(char *_s, int _n, FILE *_stream); FILE * fopen(const char *_filename, const char *_mode); int fprintf(FILE *_stream, const char *_format, ...); int fputc(int _c, FILE *_stream); int fputs(const char *_s, FILE *_stream); size_t fread(void *_ptr, size_t _size, size_t _nelem, FILE *_stream); FILE * freopen(const char *_filename, const char *_mode, FILE *_stream); int fscanf(FILE *_stream, const char *_format, ...); int fseek(FILE *_stream, long _offset, int _mode); int fsetpos(FILE *_stream, const fpos_t *_pos); long ftell(FILE *_stream); size_t fwrite(const void *_ptr, size_t _size, size_t _nelem, FILE *_stream); int getc(FILE *_stream); int getchar(void); char * gets(char *_s); void perror(const char *_s); int printf(const char *_format, ...); int putc(int _c, FILE *_stream); int putchar(int _c); int puts(const char *_s); int remove(const char *_filename); int rename(const char *_old, const char *_new); void rewind(FILE *_stream); int scanf(const char *_format, ...); void setbuf(FILE *_stream, char *_buf); int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size); int sprintf(char *_s, const char *_format, ...); int sscanf(const char *_s, const char *_format, ...); FILE * tmpfile(void); char * tmpnam(char *_s); int ungetc(int _c, FILE *_stream); int vfprintf(FILE *_stream, const char *_format, va_list _ap); int vprintf(const char *_format, va_list _ap); int vsprintf(char *_s, const char *_format, va_list _ap); int fileno(FILE *_stream); FILE * fdopen(int _fildes, const char *_type); int pclose(FILE *_pf); FILE * popen(const char *_command, const char *_mode); extern FILE __dj_stdprn, __dj_stdaux; void _djstat_describe_lossage(FILE *_to_where); int _doprnt(const char *_fmt, va_list _args, FILE *_f); int _doscan(FILE *_f, const char *_fmt, void **_argp); int _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, void **_argp); int fpurge(FILE *_f); int getw(FILE *_f); int mkstemp(char *_template); char * mktemp(char *_template); int putw(int _v, FILE *_f); void setbuffer(FILE *_f, void *_buf, int _size); void setlinebuf(FILE *_f); char * tempnam(const char *_dir, const char *_prefix); int _rename(const char *_old, const char *_new); int vfscanf(FILE *_stream, const char *_format, va_list _ap); int vscanf(const char *_format, va_list _ap); int vsscanf(const char *_s, const char *_format, va_list _ap); } # 3 "tst.cpp" 2 class bidon { int toto; public: int flags() { return toto; } }; # 1 "i8086.h" 1 void ROL_AL(void); void ROL_AL_NB(unsigned char nb); void XCHG_AX(void); void XCHG_DX(void); void NOP(void); void INT3(void); void pushf(); void popf(); union TIntStack { struct TCPU16 { unsigned short di; unsigned short si; unsigned short bp; unsigned short sp; unsigned short bx; unsigned short dx; unsigned short cx; unsigned short ax; unsigned short es; unsigned short ds; void (* Task)(); unsigned short flags; void (* Return)(); } CPU16; struct TCPU32 { long edi; long esi; long ebp; long esp; long ebx; union { long edx; unsigned short dx; }; long ecx; union { long eax; unsigned short ax; }; unsigned short es; unsigned short ds; void (* Task)(); unsigned short flags; void (* Return)(); } CPU32; }; # 14 "tst.cpp" 2 template class TValueFifo { private: unsigned Head; unsigned Tail; unsigned Count; unsigned char Buffer[1024]; public: int Empty() { return !Count; } int Full() { return Count==1024; } int Put(const bidon& Value) { if (!Full()) { ((bidon*)Buffer)[Head]=Value; if (Head>=1024-1) Head=0; else Head++; Count++; return 0; } return 1; } int PutSecure(const bidon& Value) { __asm__ __volatile__("pushf"); int Error = Put(Value); __asm__ (".byte ""0x9D") ; return Error; } TValueFifo() : Head(0), Tail(0), Count(0) {} }; TValueFifo obj; int main() { bidon b; int i=obj.PutSecure(b); }