Use ANSI string concatenation ... "does not give a valid preprocessing token"
Yves Crespin
Crespin.Quartz@Wanadoo.fr
Fri May 10 02:10:00 GMT 2002
I'm using __CONCAT() defined in /usr/include/sys/cdefs.h
#define __CONCAT(x,y) x ## y
With previous gcc version or other compiler I newer have a warning.
The preprocessor translate the following line
static char default_path[] = BLOG_TMP_DIR;
to
static char default_path[] = "/""tmp";
Do somebody know the correct compiler option to remove this warning?
Thanks,
Yves
============= Cut Here =============
#include <stdio.h>
#define BLOG_SEP_DIR "/"
#define BLOG_TMP_DIR __CONCAT(BLOG_SEP_DIR,"tmp")
int main(int argc,char *argv[])
{
static char default_path[] = BLOG_TMP_DIR;
static char a[] = __CONCAT("/","tmp");
printf("[%s]\n",default_path);
printf("[%s]\n",a);
return 0;
}
============= Cut Here =============
cc tcpp.c -o tcpp
tcpp.c:7:42: warning: pasting "BLOG_SEP_DIR" and ""tmp"" does not give a
valid preprocessing token
tcpp.c:8:31: warning: pasting ""/"" and ""tmp"" does not give a valid
preprocessing token
---
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/2002
More information about the Gcc-help
mailing list