December 22, 2023 [Issue 24297] New: ImportC incompatible with glibc _FORTIFY_SOURCE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24297 Issue ID: 24297 Summary: ImportC incompatible with glibc _FORTIFY_SOURCE Product: D Version: D2 Hardware: All OS: Linux Status: NEW Keywords: ImportC Severity: enhancement Priority: P5 Component: dmd Assignee: nobody@puremagic.com Reporter: dlang-bugzilla@thecybershadow.net $ echo '#include <stdio.h>' > test.c && dmd -P=-D_FORTIFY_SOURCE -P=-O test.c /usr/include/bits/stdio2.h(198): Error: found `0` when expecting `)` /usr/include/bits/stdio2.h(198): Error: found `)` instead of statement /usr/include/bits/stdio2.h(200): Error: found `0` when expecting `)` /usr/include/bits/stdio2.h(200): Error: found `)` instead of statement /usr/include/bits/stdio2.h(210): Error: found `0` when expecting `)` /usr/include/bits/stdio2.h(210): Error: found `)` instead of statement /usr/include/bits/stdio2.h(212): Error: found `0` when expecting `)` /usr/include/bits/stdio2.h(212): Error: found `)` instead of statement /usr/include/bits/stdio2.h(237): Error: found `0` when expecting `)` /usr/include/bits/stdio2.h(237): Error: found `)` instead of statement /usr/include/bits/stdio2.h(260): Error: no type for declarator before `return` /usr/include/bits/stdio2.h(261): Error: no type for declarator before `}` /usr/include/bits/stdio2.h(262): Error: no type for declarator before `if` /usr/include/bits/stdio2.h(264): Error: no type for declarator before `return` /usr/include/bits/stdio2.h(266): Error: no type for declarator before `}` Relevant part of the file: 194 __fortify_function __wur __fortified_attr_access (__write_only__, 1, 2) char * 195 fgets (char *__restrict __s, int __n, FILE *__restrict __stream) 196 { 197 size_t sz = __glibc_objsize (__s); 198 if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) 199 return __fgets_alias (__s, __n, __stream); 200 if (__glibc_unsafe_len (__n, sizeof (char), sz)) 201 return __fgets_chk_warn (__s, sz, __n, __stream); 202 return __fgets_chk (__s, sz, __n, __stream); 203 } Nix enables these flags automatically for its wrapped C preprocessor. It is enabled by default but can be disabled. Not sure if this is something that's at all reasonable to implement in ImportC or not. -- |
Copyright © 1999-2021 by the D Language Foundation