sciapp / gr

GR framework: a graphics library for visualisation applications
Other
329 stars 54 forks source link

Fix build error due to missing include in meta.c #49

Closed petar-andrejic closed 6 years ago

petar-andrejic commented 6 years ago

Building the python 2 version fails on Ubuntu 17.10 with the error:

lib/gr/meta.c: In function ‘argparse_calculate_needed_padding’:
lib/gr/meta.c:929:53: error: ‘uintptr_t’ undeclared (first use in this function)
     needed_padding = size_for_current_specifier - ((uintptr_t)buffer) % size_for_current_specifier;
                                                     ^~~~~~~~~
lib/gr/meta.c:929:53: note: each undeclared identifier is reported only once for each function it appears in
lib/gr/meta.c:929:63: error: expected ‘)’ before ‘buffer’
     needed_padding = size_for_current_specifier - ((uintptr_t)buffer) % size_for_current_specifier;

This can be fixed by adding the stdint.h include to meta.c. After adding the include build is successful

IngoMeyer441 commented 6 years ago

We fixed that issue by replacing uintptr_t with a ptrdiff_t. Using a ptrdiff_t has the advantage to be compatible with C89. stdint.h is part of C99.