Implement C23 const-preserving standard library macros
Frank Scheiner
frank.scheiner@web.de
Wed Nov 26 11:36:26 GMT 2025
On 22.11.25 13:35, Andreas Schwab wrote:
> On Nov 22 2025, Andreas Schwab wrote:
>
>> This now breaks the build of binutils:
>>
>> In file included from /usr/include/features.h:540,
>> from /usr/include/dlfcn.h:22,
>> from ../../../gprofng/libcollector/iolib.c:22:
>> ../../../gprofng/libcollector/iolib.c: In function ‘is_not_the_log_file’:
>> ../../../gprofng/libcollector/iolib.c:898:18: error: expected identifier before ‘_Generic’
>> 898 | if (CALL_UTIL (strstr)(fname, SP_LOG_FILE) == NULL)
>> | ^~~~~~
>> ../../../gprofng/libcollector/iolib.c:898:7: note: in expansion of macro ‘CALL_UTIL’
>> 898 | if (CALL_UTIL (strstr)(fname, SP_LOG_FILE) == NULL)
>> | ^~~~~~~~~
>> make[5]: *** [Makefile:648: libgp_collector_la-iolib.lo] Error 1
>>
>> where CALL_UTIL is defined as:
>>
>> #define CALL_UTIL(x) __collector_util_funcs.x
>
> This can be fixed by this definition:
>
> #define CALL_UTIL(x) (__collector_util_funcs.x)
While we didn't detect that in our ia64 builds with T2 because they are
done w/`--disable-gprofng` as I just found out, I detected an issue
similar to the GCC one for gprof when going though the latest build
log:
```
../../gprof/source.c: In function 'annotate_source':
../../gprof/source.c:126:21: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
126 | name_only = strrchr (sf->name, '/');
| ^
```
...but it is not made an error there. Oh, actually there are many more
also for initializations of pointers.
Comparing to a log with a glibc snapshot before cd748a6, where these
warnings are not present, confirms that this is for the same reason.
So will you come up with a patch for binutils regarding CALL_UTIL?
If you like to fix the warnings, too, please do. But I can also try
to come up with a patch for binutils regarding these warnings myself.
Unless this was already done but not pushed yet, need to check.
Cheers,
Frank
More information about the Libc-alpha
mailing list