This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
pointers are not permitted as case values
- From: Jack Howarth <howarth at bromo dot msbb dot uc dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 2 Oct 2002 11:41:55 -0400 (EDT)
- Subject: pointers are not permitted as case values
Hello,
In rebuilding some srpms on ppclinux using gcc 3.2.1pre,
I noticed that hfsplusutils no longer builds. For the
1.0.4-4 srpm of that package I now get...
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../libhfsp/src -O2 -Wall -c `test -f 'glob.c' || echo './'`glob.c
glob.c: In function `strmatch':
glob.c:51: pointers are not permitted as case values
make[2]: *** [glob.o] Error 1
which matches the code...
static
int strmatch(const char *str, const char *pat)
{
while (1)
{
if (!*str && *pat && *pat != '*')
return 0; // no more string but still pattern
switch (*pat)
{
case NULL: // pattern at end
return (!*str); // String at end ?
case '*': // match all
if (*++pat == 0)
return 1;
Does this have to be totally rewritten for gcc 3.2.1 or do
we have a simple hack like doing a cast on the *pat in the
switch statement so the compiler doesn't think it is dealing
with a pointer?
Thanks for any advice.
Jack
ps So far my attempts at casting with...
switch ( (char) *pat)
haven't fooled the compiler.