ImportC openssl/ssl.h issues due to inttypes.h
Witold Baryluk
witold.baryluk at gmail.com
Fri Feb 20 00:38:33 UTC 2026
On Wednesday, 14 January 2026 at 10:44:32 UTC, Witold Baryluk
wrote:
> gcc version 15.2.1 20251211 (Red Hat 15.2.1-5) (GCC)
>
> Fedora 42, amd64
>
> Just trying something for a test:
>
> ```
> $ gcc -E /usr/include/openssl/ssl.h > ssl.i
> /usr/include/openssl/ssl.h:19:10: warning: ‘#pragma once’ in
> main file [-Wpragma-once-outside-header]
> 19 | # pragma once
> | ^~~~
>
> $ echo 'import ssl;' > foo.d
> $ gdc foo.d
> /usr/include/inttypes.h:358:51: error: found ‘__nptr’ when
> expecting ‘,’
> 358 | extern intmax_t strtoimax (const char *__restrict
> __nptr,
> | ^
> /usr/include/inttypes.h:358:57: error: no type-specifier for
> parameter
> 358 | extern intmax_t strtoimax (const char *__restrict
> __nptr,
> |
> ^
> /usr/include/inttypes.h:359:46: error: found ‘__endptr’ when
> expecting ‘,’
> 359 | char **__restrict __endptr,
> int __base) __THROW;
> | ^
> /usr/include/inttypes.h:359:54: error: no type-specifier for
> parameter
> 359 | char **__restrict __endptr,
> int __base) __THROW;
> | ^
> /usr/include/inttypes.h:362:52: error: found ‘__nptr’ when
> expecting ‘,’
> 362 | extern uintmax_t strtoumax (const char *__restrict
> __nptr,
> | ^
> /usr/include/inttypes.h:362:58: error: no type-specifier for
> parameter
>
> ....
> ```
>
> Fail.
>
> Can we get some better documentation how to use for more than
> some toy examples?
Note to myself: Issue is with no support for `__restrict`, this
can be aliviated with defining it as a macro expanding to an
empty string.
`gcc -E -D__restrict="" /usr/include/openssl/ssl.h > ssl.i`
for example.
Also passing `-P` does help, to make error messages somehow less
confusing.
There are still some issues here and there unfortunately.
```
ssl.i:110:1: error: missing comma or semicolon after declaration
of ‘__uint16_t’, found ‘__bswap_16’ instead
110 | __bswap_16 (__uint16_t __bsx)
| ^
ssl.i:113:1: error: no type for declarator before ‘}’
113 | }
| ^
...
ssl.i:119:31: error: missing comma or semicolon after declaration
of ‘__inline’, found ‘__uint64_t’ instead
119 | __extension__ static __inline __uint64_t
...
ssl.i:339:79: error: missing comma or semicolon after declaration
of ‘strtoimax’, found ‘__asm__’ instead
339 | extern intmax_t strtoimax (const char * __nptr, char **
__endptr, int __base) __asm__ ("" "__isoc23_strtoimax")
__attribute__ ((__nothrow__ , __leaf__));
|
^
...
ssl.i:409:22: error: illegal combination of type specifiers
409 | __extension__ extern long long int atoll (const char
*__nptr)
| ^
```
This is with
gcc (Debian 15.2.0-12) 15.2.0
and
gdc 15.2.0
on Debian testing, amd64
Some of these might be addressable with a bit more macro defines,
but some like __asm__ stuff, might be tricky. These mostly do
come from standard library, so there might be a way to address it
somehow.
More information about the D.gnu
mailing list