RFR: 8295146: Clean up native code with newer C/C++ language features [v2]

Kim Barrett kbarrett at openjdk.org
Mon Nov 14 13:42:04 UTC 2022


On Mon, 14 Nov 2022 01:42:40 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> make/autoconf/flags-cflags.m4 line 632:
>> 
>>> 630:   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
>>> 631:     STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \
>>> 632:       -DJNIEXPORT='[[gnu::visibility(\"hidden\")]]'"
>> 
>> So IIUC we now use attributes via the C++11 syntax rather than compiler-specific syntax - even where the C++11 syntax is referring to a compiler specific attribute. Is that right?
>
> Yep, just something that C++ does a little neater, at least in my view

We (the HotSpot Group) have not discussed or approved the use of the new C++ attribute syntax, whether for standard attributes or compiler-specific ones.  That involves an update to the Style Guide.  I'm not convinced switching existing uses from compiler-specific `__attribute__` syntax to compiler-specific `[[attribute]]` syntax is worth the substantial code churn.

-------------

PR: https://git.openjdk.org/jdk/pull/11081



More information about the security-dev mailing list