RFR: 8347649: Build fails by clang17 after JDK-8313396
David Holmes
dholmes at openjdk.org
Wed Jan 15 00:26:34 UTC 2025
On Tue, 14 Jan 2025 12:51:56 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> This PR fix build failure by clang17 after JDK-8313396. Before this PR file src/hotspot/share/utilities/forbiddenFunctions.hpp `#include <stdlib.h>` and then `#include "forbiddenFunctions_posix.hpp"`. System header file <stdlib.h> define `realpath` function, and file forbiddenFunctions_posix.hpp add attribute declaration for `realpath` function, so clang17 report compile warning "attribute declaration must precede definition". This PR switch the sequence of `#include <stdlib.h>` and `#include "forbiddenFunctions_posix.hpp"` in file src/hotspot/share/utilities/forbiddenFunctions.hpp to fix this compile warning issue.
>
> Below code snippet shows the clang17 compile waning:
>
> void a(const char *, char *){};
> [[deprecated]] void a(const char *, char *);
>
>
> clang -Wall -c ~/compiler-test/zzkk/attribute.cpp
> /home/yansendao/compiler-test/zzkk/attribute.cpp:5:3: warning: attribute declaration must precede definition [-Wignored-attributes]
> 5 | [[deprecated]] void a(const char *, char *);
> | ^
> /home/yansendao/compiler-test/zzkk/attribute.cpp:4:6: note: previous definition is here
> 4 | void a(const char *, char *){};
> | ^
> 1 warning generated.
>
>
> Additional testing:
>
> - [ ] configure and make with gcc10 with release/fastdebug debug level
> - [ ] configure and make with gcc14 with release/fastdebug debug level
The backout was done, so this PR and issue can be closed. Thanks
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23102#issuecomment-2591377025
More information about the hotspot-dev
mailing list