bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glob: compilation error due to 'restrict'


From: Bruno Haible
Subject: glob: compilation error due to 'restrict'
Date: Mon, 12 Mar 2007 00:39:13 +0100
User-agent: KMail/1.5.4

Hi Paul,

I didn't know 'restrict' could cause compilation failures, but apparently
it can. On OSF/1 5.1, the 'glob' module gives a compilation failure:

cc -O -DHAVE_CONFIG_H -I. -I..       -c glob.c
cc: Error: glob.c, line 215: In the definition of the function "rpl_glob", the 
promoted type of pattern is incompatible with the type of the corresponding 
parameter in a prior declaration. (promotmatch)
     const char *pattern;
----------------^
cc: Error: glob.c, line 218: In the definition of the function "rpl_glob", the 
promoted type of pglob is incompatible with the type of the corresponding 
parameter in a prior declaration. (promotmatch)
     glob_t *pglob;
------------^

The problem here is that the declaration from glob.h

  extern int  rpl_glob  (const char * restrict  __pattern, int __flags,
                 int (*__errfunc) (const char *, int),
                 glob_t * restrict  __pglob)  ;

contains 'restrict' but the function definition doesn't.

Changing the function definition to use ANSI C argument list syntax (without
adding 'restrict' there) fixes the problem. Changing the function definition
by adding 'restrict' in the first and fourth argument (keeping the K&R syntax)
also fixes the problem.

Which fix to choose? Which one is likely to please the glibc developers better?

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]