Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

gpg-error.h possible(?) syntax error: #define GPG_ERR_SYSTEM_ERROR (1 << 15)

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


hedgehogshiatus at gmail

Nov 1, 2009, 2:04 AM

Post #1 of 3 (169 views)
Permalink
gpg-error.h possible(?) syntax error: #define GPG_ERR_SYSTEM_ERROR (1 << 15)

Hi,
I'm not a C/C++ guru so would appreciate anyone indicating if the
following is a bug in the generated gpg-error.h file.

This issue arose in the process of trying to create a ruby interface for gpgme.

After checking out the source for libgpg-error-1.7 and running:
./autogen.sh
./configure --enable-maintainer-mode
make

I run swig on an interface file that includes the generated gpg-error.h file.
I get the following error from swig (ver 1.3.36):

libgpg-error-1.7/src/gpg-error.h:346: Error: Syntax error in input(1).

lines 345-7 in gpg-error.h are:

/* The following error codes are used to map system errors. */
#define GPG_ERR_SYSTEM_ERROR (1 << 15)
GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,

It is not clear to me if this is an problem with gpg-error.h or swig.

Appreciate any insight.

Hedgehog

_______________________________________________
Gnupg-users mailing list
Gnupg-users[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


wk at gnupg

Nov 5, 2009, 12:04 PM

Post #2 of 3 (137 views)
Permalink
Re: gpg-error.h possible(?) syntax error: #define GPG_ERR_SYSTEM_ERROR (1 << 15) [In reply to]

On Sun, 1 Nov 2009 11:04, hedgehogshiatus[at]gmail.com said:

> It is not clear to me if this is an problem with gpg-error.h or swig.

The same code with some context:

typedef enum
{
GPG_ERR_NO_ERROR = 0,
GPG_ERR_GENERAL = 1,
[...]
GPG_ERR_EOF = 16383,

/* The following error codes are used to map system errors. */
#define GPG_ERR_SYSTEM_ERROR (1 << 15)
GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
[...]
/* This is one more than the largest allowed entry. */
GPG_ERR_CODE_DIM = 65536
} gpg_err_code_t;

Swig seems to tumble over the #define preprocessor directive within a
typedef for an enum. That is clearly a swig problem.

To fix this you may run (a working) cpp over gpg-error.h and passing its
output to swig. ("cpp gpg-error.h >gpg-error.i")


Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-users mailing list
Gnupg-users[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


hedgehogshiatus at gmail

Nov 8, 2009, 10:21 PM

Post #3 of 3 (113 views)
Permalink
Re: gpg-error.h possible(?) syntax error: #define GPG_ERR_SYSTEM_ERROR (1 << 15) [In reply to]

On Fri, Nov 6, 2009 at 7:04 AM, Werner Koch <wk[at]gnupg.org> wrote:
> On Sun,  1 Nov 2009 11:04, hedgehogshiatus[at]gmail.com said:
>
>> It is not clear to me if this is an problem with gpg-error.h or swig.
>
> The same code with some context:
>
>  typedef enum
>    {
>      GPG_ERR_NO_ERROR = 0,
>      GPG_ERR_GENERAL = 1,
>  [...]
>      GPG_ERR_EOF = 16383,
>
>      /* The following error codes are used to map system errors.  */
>  #define GPG_ERR_SYSTEM_ERROR  (1 << 15)
>      GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
>      GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
>  [...]
>      /* This is one more than the largest allowed entry.  */
>      GPG_ERR_CODE_DIM = 65536
>    } gpg_err_code_t;
>
> Swig seems to tumble over the #define preprocessor directive within a
> typedef for an enum.  That is clearly a swig problem.
>
> To fix this you may run (a working) cpp over gpg-error.h and passing its
> output to swig.  ("cpp gpg-error.h >gpg-error.i")
>

Thank-you for the suggestion.
Unfortunately cpp produced some code that `swig -ruby` choked on.
A workaround was to generate xml output from `swig -c++` and process
this xml file.

Thanks again

>
> Shalom-Salam,
>
>   Werner
>
> --
> Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
>
>



--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[.The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://wiki.hedgehogshiatus.com

_______________________________________________
Gnupg-users mailing list
Gnupg-users[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.