linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* support of __restrict and __constructor__
@ 2007-07-05 17:52 Yura Pakhuchiy
  2007-07-05 19:04 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: Yura Pakhuchiy @ 2007-07-05 17:52 UTC (permalink / raw)
  To: linux-sparse

Hi,

I updated libntfs/ntfsprogs to use sparse for checking endianness.
Thanks much for this feature, it very useful. Helped to find several
bugs in our project.

The only problem is 2 annoying lines in glibc and gnupg headers that
sparse-0.3 do not like:
1. Sparse do not like __restrict_attr inside regexec() definition in
   regex.h. Relevant code:

   extern int regexec (const regex_t *__restrict __preg,
                    const char *__restrict __string, size_t __nmatch,
                    regmatch_t __pmatch[__restrict_arr],
                    int __eflags);

   Produces following error: 
   /usr/include/regex.h:543:27: error: typename in expression
   /usr/include/regex.h:543:27: error: undefined identifier '__restrict'
   /usr/include/regex.h:543:27: error: bad constant expression type

   (Note: __restrict_arr is defined to __restrict)
2. And sparse do not know about attribute __constructor__ inside
   gpg-error.h. Relevant code:

#if _GPG_ERR_GCC_VERSION > 30100
#define _GPG_ERR_CONSTRUCTOR    __attribute__ ((__constructor__))
#define _GPG_ERR_HAVE_CONSTRUCTOR
#endif
#endif

#ifndef _GPG_ERR_CONSTRUCTOR
#define _GPG_ERR_CONSTRUCTOR
#endif

/* Initialization function.  */

/* Initialize the library.  This function should be run early.  */
gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;

I would really happy if you will fix this. Thanks!

-- 
Best regards,
        Yura

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: support of __restrict and __constructor__
  2007-07-05 17:52 support of __restrict and __constructor__ Yura Pakhuchiy
@ 2007-07-05 19:04 ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2007-07-05 19:04 UTC (permalink / raw)
  To: Yura Pakhuchiy; +Cc: linux-sparse

On Thu, 2007-07-05 at 20:52 +0300, Yura Pakhuchiy wrote:
> I updated libntfs/ntfsprogs to use sparse for checking endianness.
> Thanks much for this feature, it very useful. Helped to find several
> bugs in our project.

Very glad to hear it!

> The only problem is 2 annoying lines in glibc and gnupg headers that
> sparse-0.3 do not like:
>
> 1. Sparse do not like __restrict_attr inside regexec() definition in
>    regex.h. Relevant code:
> 
>    extern int regexec (const regex_t *__restrict __preg,
>                     const char *__restrict __string, size_t __nmatch,
>                     regmatch_t __pmatch[__restrict_arr],
>                     int __eflags);
> 
>    Produces following error: 
>    /usr/include/regex.h:543:27: error: typename in expression
>    /usr/include/regex.h:543:27: error: undefined identifier '__restrict'
>    /usr/include/regex.h:543:27: error: bad constant expression type
> 
>    (Note: __restrict_arr is defined to __restrict)

Right.  I've run into the same error, and I have this on my todo list to
fix.  Sparse just needs to parse and ignore restrict and __restrict in
array declarations like that.

> 2. And sparse do not know about attribute __constructor__ inside
>    gpg-error.h. Relevant code:
> 
> #if _GPG_ERR_GCC_VERSION > 30100
> #define _GPG_ERR_CONSTRUCTOR    __attribute__ ((__constructor__))
> #define _GPG_ERR_HAVE_CONSTRUCTOR
> #endif
> #endif
> 
> #ifndef _GPG_ERR_CONSTRUCTOR
> #define _GPG_ERR_CONSTRUCTOR
> #endif
> 
> /* Initialization function.  */
> 
> /* Initialize the library.  This function should be run early.  */
> gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;

Latest sparse from git already parses and ignores the constructor and
destructor attributes, and their double-underscore variants.

> I would really happy if you will fix this. Thanks!

No problem.  Thanks for using Sparse; glad to hear that it helped you!

- Josh Triplett

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-05 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 17:52 support of __restrict and __constructor__ Yura Pakhuchiy
2007-07-05 19:04 ` Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).