Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC + -Wpedantic throws warning about __int128 #222

Open
fzi-haxel opened this issue Dec 8, 2023 · 1 comment
Open

GCC + -Wpedantic throws warning about __int128 #222

fzi-haxel opened this issue Dec 8, 2023 · 1 comment

Comments

@fzi-haxel
Copy link

fzi-haxel commented Dec 8, 2023

If the platform supports __int128, GCC throws the following warning if the -Wpedantic flag is set.

types.h:100:18: warning: ISO C does not support ‘__int128’ types [-Wpedantic]
  100 | typedef unsigned __int128 uECC_dword_t;

Here are three ways to avoid the GCC warning

  1. Use the __attribute__((mode(TI))) (similar to mbedtls)
typedef unsigned int uECC_dword_t __attribute__((mode(TI)));
  1. Use __extension__ GCC Documentation
__extension__ typedef unsigned __int128 uECC_dword_t;
  1. Just ignore -Wpedantic at this line
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
typedef unsigned __int128 uECC_dword_t;
#pragma GCC diagnostic pop
@fzi-haxel fzi-haxel changed the title GCC + -Wpedantic' throws warning about __int128' GCC + -Wpedantic throws warning about `__int128' Dec 8, 2023
@fzi-haxel fzi-haxel changed the title GCC + -Wpedantic throws warning about `__int128' GCC + -Wpedantic throws warning about __int128 Dec 8, 2023
@greenozon
Copy link

Also hit this issue today:

└─▪ make
In file included from uECC_vli.h:7,
                 from uECC.c:4:
types.h:98:18: error: ISO C does not support ‘__int128’ types [-Werror=pedantic]
   98 | typedef unsigned __int128 uECC_dword_t;
      |                  ^~~~~~~~
cc1: all warnings being treated as errors
make: *** [makefile:129: uECC.o] Error 1


└─▪ cat /etc/issue
Ubuntu 22.04.4 LTS \n \l

┌─[±][master ?:3 ✗][micro-ecc]
└─▪ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants