gpg-error.h possible(?) syntax error: #define GPG_ERR_SYSTEM_ERROR (1 << 15)
Hedge Hog
hedgehogshiatus at gmail.com
Mon Nov 9 07:21:17 CET 2009
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
More information about the Gnupg-users
mailing list