Compile time error when compiling extension shathree.c together with sqlite3.c for Android

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile time error when compiling extension shathree.c together with sqlite3.c for Android

Ulrich Telle
When I append the source code of the SHA3 extension (shathree.c from
ext/misc directory) to the SQLite3 amalgamation (sqlite3.c), and then try to
compile it for Android, I get the following error message:

shathree.c:83:7: error: expected identifier or '('
  u64 B0, B1, B2, B3, B4;
      ^
../toolchains/llvm/prebuilt/windows/sysroot/usr/include\asm-generic/termbits.h
:118:12: note:
      expanded from macro 'B0'
#define B0 0000000
           ^

As far as I can tell header file termbits.h is pulled in as a side effect of
including <sys/ioctl.h> (which is one of the "standard include files" used in
sqlite3.c).

As a workaround I could add a preprocessor check

#ifdef B0
  #undef B0
#endif

in front of the source code in shathree.c. However, I would prefer a general
solution.

Would it be possible for the SQLite developers to adjust the variable names
used in the extension shathree.c to avoid this name clash with the macro in
termbits.h? Or what else would be the recommended method to handle this
issue?

Regards,

Ulrich
--
E-Mail privat:  [hidden email]
World Wide Web: http://www.telle-online.de


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compile time error when compiling extension shathree.c together with sqlite3.c for Android

Dan Kennedy-4

On 7/6/62 20:23, Ulrich Telle wrote:

> When I append the source code of the SHA3 extension (shathree.c from
> ext/misc directory) to the SQLite3 amalgamation (sqlite3.c), and then try to
> compile it for Android, I get the following error message:
>
> shathree.c:83:7: error: expected identifier or '('
>    u64 B0, B1, B2, B3, B4;
>        ^
> ../toolchains/llvm/prebuilt/windows/sysroot/usr/include\asm-generic/termbits.h
> :118:12: note:
>        expanded from macro 'B0'
> #define B0 0000000

Are you using up to date source code? It looks like this was fixed back
in 2017:

   https://sqlite.org/src/info/3ec7371161

Dan.



>             ^
>
> As far as I can tell header file termbits.h is pulled in as a side effect of
> including <sys/ioctl.h> (which is one of the "standard include files" used in
> sqlite3.c).
>
> As a workaround I could add a preprocessor check
>
> #ifdef B0
>    #undef B0
> #endif
>
> in front of the source code in shathree.c. However, I would prefer a general
> solution.
>
> Would it be possible for the SQLite developers to adjust the variable names
> used in the extension shathree.c to avoid this name clash with the macro in
> termbits.h? Or what else would be the recommended method to handle this
> issue?
>
> Regards,
>
> Ulrich
> --
> E-Mail privat:  [hidden email]
> World Wide Web: http://www.telle-online.de
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compile time error when compiling extension shathree.c together with sqlite3.c for Android

Richard Hipp-3
In reply to this post by Ulrich Telle
On 6/7/19, Ulrich Telle <[hidden email]> wrote:
> Would it be possible for the SQLite developers to adjust the variable names
> used in the extension shathree.c to avoid this name clash with the macro in
> termbits.h?

https://www.sqlite.org/src/timeline?c=3ec73711
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Compile time error when compiling extension shathree.c together with sqlite3.c for Android

Ulrich Telle
In reply to this post by Dan Kennedy-4
Am 07.06.2019 um 15:34 schrieb Dan Kennedy:

>
> On 7/6/62 20:23, Ulrich Telle wrote:
>> When I append the source code of the SHA3 extension (shathree.c from
>> ext/misc directory) to the SQLite3 amalgamation (sqlite3.c), and then
>> try to
>> compile it for Android, I get the following error message:
>>
>> shathree.c:83:7: error: expected identifier or '('
>>    u64 B0, B1, B2, B3, B4;
>>        ^
>> ../toolchains/llvm/prebuilt/windows/sysroot/usr/include\asm-generic/termbits.h
>>
>> :118:12: note:
>>        expanded from macro 'B0'
>> #define B0 0000000
>
> Are you using up to date source code? It looks like this was fixed back
> in 2017:
>
>    https://sqlite.org/src/info/3ec7371161

*Ouch*. I simply missed this change and didn't update to the latest
version of shathree.c. Thanks!

Sorry for the noise on this list.

Regards,

Ulrich


>> As far as I can tell header file termbits.h is pulled in as a side
>> effect of
>> including <sys/ioctl.h> (which is one of the "standard include files"
>> used in
>> sqlite3.c).
>>
>> As a workaround I could add a preprocessor check
>>
>> #ifdef B0
>>    #undef B0
>> #endif
>>
>> in front of the source code in shathree.c. However, I would prefer a
>> general
>> solution.
>>
>> Would it be possible for the SQLite developers to adjust the variable
>> names
>> used in the extension shathree.c to avoid this name clash with the
>> macro in
>> termbits.h? Or what else would be the recommended method to handle this
>> issue?

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users