-Wall, preprocesor, const foo, and pointers
Hello,
I would like to package my software (ITP #187282). I would like to have it
compiled cleanly with -Wall (well, at least on x86). There is a problem with
some pcre_* functions.
Let's see what manual says about pcre_compile:
pcre *pcre_compile(const char *pattern, int options,
const char **errptr, int *erroffset,
const unsigned char *tableptr);
Well, let's check, what is in /usr/incluce/pcre.h:
extern pcre *pcre_compile(const char *, int, const char **,
int *, const unsigned char *);
OK, types match.
So, let's take a look into my code (well, just except):
const char *re_error;
*pre=pcre_compile(re,PCRE_COPT,&re_error,&re_errno,NULL);
CFLAGS="-Wall -Werror" make gives:
strpcre.c: In function `compile_re':
strpcre.c:75: warning: passing arg 3 of `pcre_compile' from incompatible pointer type
(and similar errors for pcre_study, pcre_get_substring_list
and pcre_free_substring_list)
I run gcc -E on this strpcre.c. Results amased me.
extern pcre *pcre_compile(const char *, int, const char **,
int *, const unsigned char *);
it is ok, but:
char *re_error;
*pre=pcre_compile(re,0x0001|0x0004,&re_error,&re_errno,((void *)0));
so, what's happened with const keyword? Is it any preprocesor bug/feature?
Did I forget about someting?
To make a picture complete:
arturcz@blabluga:~$ gcc --version
gcc (GCC) 3.3.3 20031229 (prerelease) (Debian)
arturcz@blabluga:~$ dpkg -l gcc
[...]
ii gcc 3.3.2-2 The GNU C compiler
If you want to do any test for yourself public CVS is available. Reference
at: http://sourceforge.net/cvs/?group_id=55979
Any help/suggestions welcomed.
Cheers
Artur
--
Someone needs to beat panasync six miles deep into hard granite for even
thinking about making that a BitchX default.
http://sackheads.org/~bnaylor/spew/away_msgs.html
Reply to: