On Tue, 5 Dec 2023 17:26:06 GMT, Srinivas Vamsi Parasa <d...@openjdk.org> wrote:

>> That sounds weird. You can't check for if compiler options should be enabled 
>> or not inside source code files.
>> 
>> Are you saying that when compiling with GCC 6, it will just silently ignore 
>> `-std=c++17`? I'd have assumed that it printed a warning or error about an 
>> unknown or invalid option, if C++17 is not supported.
>
> Hi Magnus (@magicus),
>  
>> Are you saying that when compiling with GCC 6, it will just silently ignore 
>> `-std=c++17`? I'd have assumed that it printed a warning or error about an 
>> unknown or invalid option, if C++17 is not supported.
> 
> The GCC complier for versions 6 (and even 5) silently ignores the flag 
> `-std=c++17`. It does not print any warning or error. I tested it with a toy 
> C++ program and also by building OpenJDK using GCC 6. 
> 
>> You can't check for if compiler options should be enabled or not inside 
>> source code files.
> 
>  what I meant was, there are #ifdef guards using predefined macros in the C++ 
> source code to check for GCC version and make the simdsort code available for 
> compilation or not based on the GCC version
> 
> 
> // src/java.base/linux/native/libsimdsort/simdsort-support.hpp
> #if defined(_LP64) && (defined(__GNUC__) && ((__GNUC__ > 7) || ((__GNUC__ == 
> 7) && (__GNUC_MINOR__ >= 5))))
>         #define __SIMDSORT_SUPPORTED_LINUX
> #endif
> 
> 
> 
> //src/java.base/linux/native/libsimdsort/avx2-linux-qsort.cpp
> #include "simdsort-support.hpp"
> #ifdef __SIMDSORT_SUPPORTED_LINUX
>             <simdsort functions>
> #endif

Okay, then I guess I am fine with this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16534#discussion_r1417170882

Reply via email to