This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in C preprocessor


Hello.  I'm having a problem with the C preprocessor not handling a
"#ifdef" correctly.

GCC Version: 2.95.1
Host system: AIX 4.3.1
Compiler command line: gcc test.c -o test
error message:
In file included from test.c:2:
test.h:2: unterminated string or character constant

If I use the following command line, my program compiles just fine: gcc
-trigraphs test.c -o test

I believe my program shoud be able to compile without having to specify
"-trigraphs" because the trigraph is in a #ifdef block for a platform that
is *not* defined.

Thanks in advance for your time!

Peace....

Tom Williams
tom.williams@diversifiedsoftware.com

Here is test.c:

#include <stdio.h>
#include "test.h"

int main(int argc, char **argv)
{
     puts("Hello World!");
     return 0;
}

Here is test.h:

#if defined (__MVS__)
#define XOR ??'
#else
#define XOR ^
#endif // __MVS__

Here is test.i:

# 1 "test.c"
# 1
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 1 3

# 1
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdarg.h
" 1 3






































































typedef char *__gnuc_va_list;







# 122
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdarg.h
" 3




















# 209
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdarg.h
" 3




# 2
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3
















# 34
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 3











# 1 "/usr/include/standards.h" 1 3
















































































# 98 "/usr/include/standards.h" 3


















# 45
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3






























typedef unsigned long    size_t;








typedef long   fpos_t;



typedef long long fpos64_t;

















































typedef struct {
     unsigned char  *_ptr;
     int  _cnt;
     unsigned char  *_base;
     unsigned char   *_bufendp;
     short     _flag;
     short     _file;
     int  __stdioid;
     char *__newbase;



     long _unused[1];




} FILE;




extern FILE    _iob[16 ];












extern size_t  fread(void *, size_t, size_t, FILE *);
extern size_t  fwrite(const void *, size_t, size_t,FILE *);


# 220
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 3


extern int     __flsbuf(unsigned char, FILE *);
extern int     __filbuf(FILE *);
extern int     ferror(FILE *);
extern int     feof(FILE *);
extern void    clearerr(FILE *);
extern int     putchar(int);
extern int     getchar(void);
extern int     putc(int, FILE *);
extern int     getc(FILE *);
extern int     remove(const char *);
extern int     rename(const char *, const char *);
extern FILE    *tmpfile(void);
extern char    *tmpnam(char *);
extern int     fclose(FILE *);
extern int     fflush(FILE *);
extern FILE    *fopen(const char *, const char *);
extern FILE    *freopen(const char *, const char *, FILE *);
extern void    setbuf(FILE *, char *);
extern int     setvbuf(FILE *, char *, int, size_t);
extern int     fprintf(FILE *, const char *, ...);
extern int     fscanf(FILE *, const char *, ...);
extern int     printf(const char *, ...);
extern int     scanf(const char *, ...);
extern int     sprintf(char *, const char *, ...);

extern int     snprintf(char *, size_t, const char *, ...);

extern int     sscanf(const char *, const char *, ...);










# 1 "/usr/include/va_list.h" 1 3
















# 33 "/usr/include/va_list.h" 3





























typedef   char *va_list;

# 72 "/usr/include/va_list.h" 3

# 260
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3

extern int     vfprintf(FILE *, const char *, __gnuc_va_list);
extern int     vprintf(const char *, __gnuc_va_list);
extern int     vsprintf(char *, const char *, __gnuc_va_list);

extern int     vsnprintf(char *, size_t, const char *, __gnuc_va_list);



extern int     fgetc(FILE *);
extern char    *fgets(char *, int, FILE *);
extern int     fputc(int, FILE *);
extern int     fputs(const char *, FILE *);
extern char    *gets(char *);
extern int     puts(const char *);
extern int     ungetc(int, FILE *);
extern int     fgetpos(FILE *, fpos_t *);
extern int     fseek(FILE *, long int, int);
extern int     fsetpos(FILE *, const fpos_t *);
extern long    ftell(FILE *);
extern void    rewind(FILE *);
extern void    perror(const char *);





extern int     getc_unlocked(FILE *);
extern int     getchar_unlocked(void);
extern int     putc_unlocked(int, FILE *);
extern int     putchar_unlocked(int);




# 338
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 3



























# 1
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 1 3




































# 1 "/usr/include/sys/inttypes.h" 1 3































































typedef signed char      int8_t;
typedef signed short          int16_t;
typedef signed int       int32_t;




typedef   signed long long    int64_t;



typedef unsigned char         uint8_t;
typedef unsigned short        uint16_t;
typedef unsigned int          uint32_t;




typedef unsigned long long    uint64_t;








typedef int64_t               intmax_t;
typedef uint64_t         uintmax_t;










typedef signed long      intptr_t;
typedef unsigned long         uintptr_t;





typedef signed char      int_least8_t;
typedef signed short          int_least16_t;
typedef signed int       int_least32_t;




typedef signed long long int_least64_t;



typedef unsigned char         uint_least8_t;
typedef unsigned short        uint_least16_t;
typedef unsigned int          uint_least32_t;




typedef unsigned long long    uint_least64_t;








typedef int32_t     intfast_t;
typedef uint32_t    uintfast_t;


typedef signed char int_fast8_t;
typedef int32_t          int_fast16_t;
typedef int32_t          int_fast32_t;
typedef uint32_t    uint_fast8_t;
typedef uint32_t    uint_fast16_t;
typedef uint32_t    uint_fast32_t;

typedef int64_t          int_fast64_t;
typedef uint64_t    uint_fast64_t;








































































































































































































































































































































































































































typedef signed long __long32_t;
typedef unsigned long    __ulong32_t;








typedef signed char      int8;
typedef signed short          int16;
typedef signed int       int32;




typedef   signed long long    int64;



typedef unsigned char         u_int8;
typedef unsigned char         u_int8_t;
typedef unsigned short        u_int16;
typedef unsigned short        u_int16_t;
typedef unsigned int          u_int32;
typedef unsigned int          u_int32_t;





typedef unsigned long long    u_int64;
typedef unsigned long long    u_int64_t;









# 37
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 2 3
























typedef long int ptrdiff_t;








typedef short unsigned int wchar_t;





typedef unsigned int     wctype_t;


# 92
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3




typedef   int       time_t;




typedef int         clock_t;


# 113
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3








typedef   unsigned char  uchar_t;
typedef   unsigned short ushort_t;
typedef   unsigned int   uint_t;
typedef unsigned long    ulong_t;
typedef signed long ssize_t;




typedef int         level_t;
typedef   int       daddr_t;
typedef   char *         caddr_t;
typedef   unsigned int   ino_t;
typedef short       cnt_t;
typedef unsigned int     dev_t;
typedef   int       chan_t;

typedef int soff_t;




typedef long        off_t;



typedef long long   off64_t;


typedef   long      paddr_t;
typedef   int       key_t;
typedef int         timer_t;
typedef   short          nlink_t;
typedef   uint_t         mode_t;
typedef uint_t      uid_t;
typedef uint_t      gid_t;
typedef   void *         mid_t;
typedef   int       pid_t;
typedef int             tid_t;
typedef char        slab_t[12];
typedef long        mtyp_t;
typedef int             boolean_t;


typedef int         blkcnt_t;
typedef int         blksize_t;




typedef ulong_t     fsblkcnt_t;
typedef ulong_t          fsfilcnt_t;



     typedef   int       wint_t;



typedef uint_t      id_t;
typedef unsigned int     useconds_t;
typedef signed   int     suseconds_t;
typedef int         clockid_t;




typedef struct sigset_t  {

     unsigned int losigs;
     unsigned int hisigs;




} sigset_t;

typedef int signal_t;




typedef struct fsid_t {

     unsigned int val[2];



} fsid_t;

typedef struct __ptq_queue {
     struct __ptq_queue  *__ptq_next;
     struct __ptq_queue  *__ptq_prev;
} __ptq_queue;

typedef int __ptlock_type;

typedef struct __pt_attr *pthread_attr_t;
typedef   struct __pt_attr *pthread_condattr_t;
typedef   struct __pt_attr *pthread_mutexattr_t;


typedef   struct __pt_attr *pthread_rwlockattr_t;


typedef unsigned int pthread_t;
typedef unsigned int pthread_key_t;

# 261
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3


typedef struct {
        __ptq_queue *   __ptq_link;
        int             __reserved1;
        __ptlock_type   __ptmtx_lock;
        int             __ptmtx_flags;
        pthread_t       __ptmtx_owner;
        int             __mtx_id;
        int             __acquisitions;
        int             __mtx_kind;
        int             __lock_cpt;
        int             __sleeps;
        int             __misses;
        int             __reserved2;
        unsigned long   __ptmtx_dbx;
} pthread_mutex_t;

typedef struct {
        unsigned long   __ptcv_dbx;
        int             __reserved1;
        __ptlock_type   __ptcv_lock;
        int             __ptcv_flags;
        __ptq_queue *   __ptcv_waiters;
        int             __reserved2;
        int             __cv_id;
        pthread_mutex_t *__cv_mutex;
        int             __reserved3;
        int             __cptwait;
        int             __reserved;

} pthread_cond_t;



typedef struct {
     __ptlock_type  __ptonce_lock;
     int       __ptonce_initialized;
     int       __ptonce_executing;
     int       __ptonce_completed;
     pthread_mutex_t     __ptonce_mutex;
     pthread_cond_t __ptonce_executed;
} pthread_once_t;


typedef struct {





        int             __pad;
        unsigned long   __ptrlock_dbx;


        pthread_mutex_t __rwl_mutex;
        pthread_cond_t  __rwl_rsleepers;
        pthread_cond_t  __rwl_wsleepers;
        int             __rwl_flags;
        pthread_t       __rwl_owner;
        int             __rwl_rwlock_id;
        int             __rwl_lock_count;


        int             __rwl_waiting;
        int             __rwl_wacquisitions;
        int             __rwl_racquisitions;
        int             __rwl_wsleeps;
        int             __rwl_rsleeps;
        unsigned long   __reserved[6];
} pthread_rwlock_t;






typedef void * __ptr32;







# 1 "/usr/include/sys/m_types.h" 1 3












































typedef struct

label_t

{

     struct label_t   *prev;
     ulong_t           iar;
     ulong_t           stack;
     ulong_t           toc;
     ulong_t           cr;
     ulong_t           intpri;
     ulong_t           reg[19];
# 66 "/usr/include/sys/m_types.h" 3

} label_t;

typedef __long32_t  vmid_t;
typedef __ulong32_t vmhandle_t;

typedef struct

vmaddr_t

{

     vmhandle_t     srval;
     caddr_t        offset;




} vmaddr_t;

typedef struct

adspace_t

{

     __ulong32_t    alloc;
     vmhandle_t     srval[16];




} adspace_t;



# 346
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 2 3



















# 373
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3





typedef ushort_t    UniChar;




typedef   uchar_t        uchar;
typedef   ushort_t  ushort;
typedef   uint_t         uint;
typedef ulong_t          ulong;

typedef   struct { int r[1]; } *   physadr_t;
typedef   physadr_t physadr;


typedef   unsigned char  u_char;
typedef   unsigned short u_short;
typedef   unsigned int   u_int;
typedef   unsigned long  u_long;

typedef   struct    _quad { int val[2]; } quad;
typedef   int  swblk_t;




struct sigset  {
     unsigned int losigs;
     unsigned int hisigs;
};


struct fsid {
     unsigned int   val[2];
};








struct fileid {
     uint_t    fid_len;
     ino_t     fid_ino;
     uint_t    fid_gen;
     char fid_x[(32  - sizeof(fsid_t) - sizeof(uint_t))  - (sizeof(ino_t) +
 2) - sizeof(uint_t)];
};

# 439
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3


struct fid {
     uint_t    fid_len;
     char fid_data[(32  - sizeof(fsid_t) - sizeof(uint_t)) ];
};
typedef struct fid fid_t;


struct fhandle {
     char x[32 ];
};
typedef struct fhandle fhandle_t;

struct filehandle {
     fsid_t         fh_fsid;
     struct fileid  fh_fid;
};








struct unique_id {

       unsigned long word1;
       unsigned long word2;
       unsigned long word3;
       unsigned long word4;






};
typedef struct unique_id unique_id_t;

# 500
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/sys/type
s.h" 3



typedef   long long  offset_t;





typedef unsigned long long size64_t;
typedef long long ssize64_t;






typedef long long longlong_t;
typedef unsigned long long u_longlong_t;









# 365
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3











extern int     fileno(FILE *);
extern FILE    *fdopen(int,const char *);
extern char    *ctermid(char *);

extern void    flockfile(FILE *);
extern void    funlockfile(FILE *);
extern int     fseeko(FILE *, off_t, int);
extern off_t   ftello(FILE *);
extern int     ftrylockfile(FILE *);
extern void    funlockfile(FILE *);












# 1 "/usr/include/va_list.h" 1 3
















# 33 "/usr/include/va_list.h" 3



























# 72 "/usr/include/va_list.h" 3

# 398
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3


extern    char *optarg;
extern    int  opterr;
extern    int  optind;
extern    int  optopt;



# 415
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 3

extern int     getw(FILE *);
extern int     putw(int, FILE *);
extern char    *tempnam(const char*, const char*);
extern FILE    *popen(const char *, const char *);
extern int     pclose(FILE *);
extern int     getopt(int, char * const [], const char*);
extern char    *cuserid(char *);









# 1 "/usr/include/sys/limits.h" 1 3






































































































































































































































# 1 "/usr/include/float.h" 1 3



































































































































































# 176 "/usr/include/float.h" 3






























     extern  unsigned   int SINFINITY;
     extern  unsigned   int _DBLINF[2];
     extern  unsigned   int SQNAN;
     extern  unsigned   int DQNAN[2];
     extern  unsigned   int SSNAN;
     extern  unsigned   int DSNAN[2];

























typedef   unsigned short fprnd_t;








fprnd_t fp_read_rnd(void);
fprnd_t fp_swap_rnd(fprnd_t rnd);




























# 231 "/usr/include/sys/limits.h" 2 3



# 262 "/usr/include/sys/limits.h" 3



























































































































# 432
"/usr/local/egcs/lib/gcc-lib/powerpc-ibm-aix4.3.1.0/2.95.1/include/stdio.h"
 2 3




extern int fgetpos64(FILE *, fpos64_t *);
extern FILE *fopen64(const char *, const char *);
extern FILE *freopen64(const char *, const char *, FILE *);
extern int fseeko64(FILE *, off64_t, int);
extern int fsetpos64(FILE *, const fpos64_t *);
extern off64_t ftello64(FILE *);






extern void setbuffer(FILE *, char *, size_t);
extern void setlinebuf(FILE *);







































































# 1 "test.c" 2

# 1 "test.h" 1





# 2 "test.c" 2


int main(int argc, char **argv)
{
     puts("Hello World!");
     return 0;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]