Fix warnings on anonymous structs for MSVC (#198)

* MSVC allows anon structs even in conforming mode

* Convert Windows CI to PowerShell

* Compile tests in C++ mode

* Optionally enable C++ testing

* Backpropagate CI from Layers/SDK

* Add header to Mac CI

* Change to base image

* Clang on Windows

* Clang using pre-C11 mode

* C++ tests without feeding .c files (Clang warning)

* Guard Clang macro better

* Remove hexadecimal constant

* Fix cwd

* Fix CWD for Mac too

* Clean up MSVC anon struct detection

* Remove unused debug macro
This commit is contained in:
Nagy-Egri Máté Ferenc 2022-05-03 01:35:42 +02:00 committed by GitHub
parent dcd5bede68
commit 3568763309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 609 additions and 406 deletions

View File

@ -1,363 +0,0 @@
name: Build
on: [push, pull_request]
jobs:
linux-gcc:
runs-on: ubuntu-18.04
strategy:
matrix:
#VER: [7, 8, 9]
VER: [7, 9] # gcc-8 is not installed on the Ubuntu 18.04 image
EXT: [ON, OFF]
GEN: [Unix Makefiles, Ninja]
VAR: [Debug, Release]
STD: [99, 11] # 90 results in errors
BIN: [32, 64]
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: sudo apt-get update -q;
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/bare;
cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/sdk;
if [[ "${{matrix.GEN}}" == "Ninja" && ! `which ninja` ]]; then sudo apt install -y ninja-build; fi;
if [[ "${{matrix.BIN}}" == "32" ]]; then sudo apt install -y gcc-multilib gcc-8-multilib gcc-9-multilib; fi
# Install Ninja only if it's the selected generator and it's not available.
- name: Configure CMake
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/build
--
-j`nproc`
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: bash
run: ctest --parallel `nproc`
- name: Install
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/build
--target install
--
-j`nproc`
- name: Consume (Configure PkgConfig - bare)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/downstream/pkgconfig/bare
- name: Consume (Build PkgConfig - bare)
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/downstream/pkgconfig/bare
--
-j`nproc`
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/sdk
-B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
- name: Consume (Build PkgConfig - SDK)
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
--
-j`nproc`
windows-msvc:
runs-on: windows-latest
strategy:
matrix:
VER: [v140, v141, v142]
EXT: [ON, OFF]
GEN: [Visual Studio 16 2019, Ninja Multi-Config]
BIN: [x64, x86]
#STD Proper 11, 17 incoming: https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
shell: cmd
run: |
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
- name: Configure (MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build
- name: Configure (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build
- name: Build (MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\build --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\build --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\build --config Release
cmake --build %GITHUB_WORKSPACE%\build --config Debug
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: cmd
run: |
ctest -C Release --parallel %NUMBER_OF_PROCESSORS%
- name: Install
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%/build --config Release --target install
- name: Consume (Configure PkgConfig - bare MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare
- name: Consume (Configure PkgConfig - bare Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare
- name: Consume (Build PkgConfig - bare MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Consume (Build PkgConfig - bare Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk
- name: Consume (Configure PkgConfig - SDK Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk
- name: Consume (Build PkgConfig - SDK MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Consume (Build PkgConfig - SDK Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug
macos-gcc:
runs-on: macos-latest
strategy:
matrix:
VER: [8, 9]
EXT: [ON, OFF]
#GEN: [Xcode, Ninja Multi-Config]
GEN: [Xcode] # Disabling Ninja - need to investigate setup-ninja?
STD: [99, 11] # 90 results in errors
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: |
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi;
# Install Ninja only if it's the selected generator and it's not available.
- name: Configure CMake
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build (Xcode)
if: matrix.GEN == 'Xcode'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release
cmake --build $GITHUB_WORKSPACE/build --config Debug
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release
cmake --build $GITHUB_WORKSPACE/build --config Debug
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: bash
run: ctest -C Release --parallel `sysctl -n hw.logicalcpu`
- name: Install (Xcode)
if: matrix.GEN == 'Xcode'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Install (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Consume (Configure PkgConfig - bare)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/downstream/pkgconfig/bare
- name: Consume (Build PkgConfig - bare)
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Release
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Debug
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/sdk
-B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
- name: Consume (Build PkgConfig - SDK)
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Release
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Debug

202
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,202 @@
name: Linux
on: [push, pull_request]
jobs:
compatibility:
runs-on: ubuntu-18.04
container: streamhpc/opencl-sdk-base:ubuntu-18.04-20220127
strategy:
matrix:
# TODO: CMake 3.0.2 is Headers minimum (and ubuntu 18.04 canonical apt repo ver), not this repo's min
# Replace once backport to C++14 happened
include:
# Unix Makefiles
# One CMake version
# For all compilers
# For all configurations
# For all target architectures
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 64
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 64
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 32
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 32
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 64
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 64
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 32
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 32
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 64
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 64
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 32
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 32
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 64
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 64
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Debug
BIN: 32
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.0.2
GEN: Unix Makefiles
CONFIG: Release
BIN: 32
# Multi-config generators
# One CMake version
# For all compilers
# For all architectures
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 64
- C_COMPILER: gcc-7
CXX_COMPILER: g++-7
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 32
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 64
- C_COMPILER: gcc-11
CXX_COMPILER: g++-11
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 32
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 64
- C_COMPILER: clang-8
CXX_COMPILER: clang++-8
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 32
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 64
- C_COMPILER: clang-13
CXX_COMPILER: clang++-13
CMAKE: 3.22.1
GEN: Ninja Multi-Config
BIN: 32
env:
CMAKE_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cmake
CTEST_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/ctest
steps:
- name: Checkout OpenCL-Headers
uses: actions/checkout@v2
- name: Configure
shell: bash
run: $CMAKE_EXE
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
`if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]]; then echo -D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}; fi;`
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=${{matrix.C_COMPILER}}
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -m${{matrix.BIN}}"
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-B$GITHUB_WORKSPACE/build
-H$GITHUB_WORKSPACE
- name: Build
shell: bash
run: if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]];
then
$CMAKE_EXE --build $GITHUB_WORKSPACE/build -- -j`nproc`;
else
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Debug -- -j`nproc`;
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release -- -j`nproc`;
fi;
- name: Test
shell: bash
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
run: if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]];
then
$CTEST_EXE --output-on-failure --parallel `nproc`;
else
$CTEST_EXE --output-on-failure -C Debug --parallel `nproc`;
$CTEST_EXE --output-on-failure -C Release --parallel `nproc`;
fi;

53
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: MacOS
on: [push, pull_request]
jobs:
compatibility:
runs-on: macos-latest
strategy:
matrix:
VER: [9, 11]
GEN: [Xcode, Ninja Multi-Config]
STD: [11, 17]
steps:
- name: Checkout OpenCL-Headers
uses: actions/checkout@v2
- name: Create Build Environment
shell: bash
run: |
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi;
# Install Ninja only if it's the selected generator and it's not available.
cmake --version
- name: Configure CMake
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
-D CMAKE_CXX_COMPILER=/usr/local/bin/g++-${{matrix.VER}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;`
cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;`
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: bash
run: |
ctest -C Release --output-on-failure --parallel `sysctl -n hw.logicalcpu`
ctest -C Debug --output-on-failure --parallel `sysctl -n hw.logicalcpu`

247
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,247 @@
name: Windows
on: [push, pull_request]
jobs:
compatibility:
runs-on: windows-latest
strategy:
matrix:
VER: [v142, v143]
EXT: [ON, OFF]
GEN: [Visual Studio 17 2022]
BIN: [x64, x86]
STD: [99, 11, 17]
include:
- VER: v141
EXT: OFF
GEN: Ninja Multi-Config
BIN: x64
STD: 89 # /Za
env:
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip
NINJA_ROOT: C:\Tools\Ninja
VS_ROOT: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'
UseMultiToolTask: true # Better parallel MSBuild execution
steps:
- uses: actions/checkout@v2
- name: Cache Ninja install
if: matrix.GEN == 'Ninja Multi-Config'
id: ninja-install
uses: actions/cache@v2
with:
path: |
C:\Tools\Ninja
key: ${{runner.os}}-ninja-${{env.NINJA_URL}}
- name: Install Ninja
if: matrix.GEN == 'Ninja Multi-Config' && steps.ninja-install.outputs.cache-hit != 'true'
shell: pwsh
run: |
Invoke-WebRequest ${env:NINJA_URL} -OutFile ~\Downloads\ninja-win.zip
Expand-Archive ~\Downloads\ninja-win.zip -DestinationPath ${env:NINJA_ROOT}\
Remove-Item ~\Downloads\*
- name: Configure (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: pwsh
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D BUILD_TESTING=ON `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}\build"
- name: Configure (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
shell: pwsh
run: |
$VER = switch ('${{matrix.VER}}') { `
'v141' {'14.1'} `
'v142' {'14.2'} `
'v143' {'14.3'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=${VER}"
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=ON `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-D CMAKE_EXE_LINKER_FLAGS='/INCREMENTAL' `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}\build"
- name: Build (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: pwsh
run: |
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config ${Config} `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo
}
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: pwsh
run: |
$VER = switch ('${{matrix.VER}}') { `
'v141' {'14.1'} `
'v142' {'14.2'} `
'v143' {'14.3'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=${VER}"
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config ${Config} `
-- `
-j ${env:NUMBER_OF_PROCESSORS}
}
- name: Test
shell: pwsh
run: |
foreach ($Config in 'Release','Debug') { `
& ctest `
--test-dir "${env:GITHUB_WORKSPACE}\build" `
--build-config ${Config} `
--output-on-failure `
--parallel ${env:NUMBER_OF_PROCESSORS}
}
- name: Install
shell: pwsh
run: |
& cmake `
--install "${env:GITHUB_WORKSPACE}\build" `
--prefix "${env:GITHUB_WORKSPACE}\install" `
--config Release
- name: Consume (PkgConfig - bare MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: pwsh
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\bare" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare"
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" `
--config ${Config} `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo `
}
- name: Consume (PkgConfig - bare Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: pwsh
run: |
$VER = switch ('${{matrix.VER}}') { `
'v141' {'14.1'} `
'v142' {'14.2'} `
'v143' {'14.3'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=${VER}"
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=ON `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-D CMAKE_EXE_LINKER_FLAGS='/INCREMENTAL' `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\bare" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare"
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" `
--config ${Config} `
-- `
-j ${env:NUMBER_OF_PROCESSORS} `
}
- name: Consume (Emulate SDK presence)
shell: pwsh
run: |
New-Item -Type Directory -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL
New-Item -Type File -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL\OpenCLConfig.cmake -Value 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")'
- name: Consume (PkgConfig - SDK MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: pwsh
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\sdk" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk"
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" `
--config ${Config} `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo `
}
- name: Consume (PkgConfig - SDK Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: pwsh
run: |
$VER = switch ('${{matrix.VER}}') { `
'v141' {'14.1'} `
'v142' {'14.2'} `
'v143' {'14.3'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=${VER}"
$C_FLAGS = '/W4 /WX'
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=ON `
-D CMAKE_C_FLAGS="${C_FLAGS}" `
-D CMAKE_C_EXTENSIONS='${{matrix.EXT}}' `
-D CMAKE_EXE_LINKER_FLAGS='/INCREMENTAL' `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\sdk" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk"
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" `
--config ${Config} `
-- `
-j ${env:NUMBER_OF_PROCESSORS} `
}

View File

@ -141,6 +141,10 @@ typedef struct _cl_image_desc {
#pragma warning( push )
#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 builds */
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc11-extensions" /* Prevents warning about nameless union being C11 extension*/
#endif
#if defined(_MSC_VER) && defined(__STDC__)
/* Anonymous unions are not supported in /Za builds */
#else
@ -158,6 +162,9 @@ typedef struct _cl_image_desc {
#if defined(_MSC_VER) && !defined(__STDC__)
#pragma warning( pop )
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
} cl_image_desc;

View File

@ -21,6 +21,7 @@
#if _MSC_VER >=1500
#pragma warning( push )
#pragma warning( disable : 4201 )
#pragma warning( disable : 5105 )
#endif
#endif
#include <d3d10.h>

View File

@ -21,6 +21,7 @@
#if _MSC_VER >=1500
#pragma warning( push )
#pragma warning( disable : 4201 )
#pragma warning( disable : 5105 )
#endif
#endif
#include <d3d11.h>

View File

@ -32,7 +32,19 @@ typedef cl_uint cl_dx9_media_adapter_type_khr;
typedef cl_uint cl_dx9_media_adapter_set_khr;
#if defined(_WIN32)
#if defined(_MSC_VER)
#if _MSC_VER >=1500
#pragma warning( push )
#pragma warning( disable : 4201 )
#pragma warning( disable : 5105 )
#endif
#endif
#include <d3d9.h>
#if defined(_MSC_VER)
#if _MSC_VER >=1500
#pragma warning( pop )
#endif
#endif
typedef struct _cl_dx9_surface_info_khr
{
IDirect3DSurface9 *resource;

View File

@ -135,6 +135,11 @@ extern "C" {
#if (defined (_WIN32) && defined(_MSC_VER))
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#endif
/* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
/* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
#if defined(__clang__) || _MSC_VER >= 1600
@ -155,6 +160,10 @@ typedef unsigned __int16 cl_half;
typedef float cl_float;
typedef double cl_double;
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
/* Macro names and corresponding values defined by OpenCL */
#define CL_CHAR_BIT 8
#define CL_SCHAR_MAX 127
@ -501,25 +510,23 @@ typedef unsigned int cl_GLenum;
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__
#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__)
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__
#elif defined(__GNUC__) && ! defined(__STRICT_ANSI__)
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__ __extension__
#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
#if _MSC_VER >= 1500
/* Microsoft Developer Studio 2008 supports anonymous structs, but
* complains by default. */
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless
* struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
#else
#define __CL_HAS_ANON_STRUCT__ 0
#define __CL_ANON_STRUCT__
#endif
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
/* Define alignment keys */
#if defined( __GNUC__ ) || defined(__INTEGRITY)
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
@ -1395,12 +1402,8 @@ typedef union
}
#endif
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
#if _MSC_VER >=1500
#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
#endif
#endif
#endif /* __CL_PLATFORM_H */

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0...3.22)
# Include guard for including this project multiple times
if(TARGET Headers)
@ -12,6 +13,7 @@ project(OpenCLHeaders
)
option(OPENCL_HEADERS_BUILD_TESTING "Enable support for OpenCL C headers testing." OFF)
option(OPENCL_HEADERS_BUILD_CXX_TESTS "Enable support for OpenCL C headers testing in C++ mode." ON)
include(GNUInstallDirs)

View File

@ -1,14 +1,29 @@
# Add a test for a given source file for each version of OpenCL
function(add_header_test NAME SOURCE)
foreach(VERSION 100 110 120 200 210 220 300)
set(TEST_EXE ${NAME}_${VERSION})
# Some headers include system files which require anonymous structs
# so we cannot test them with /Za:
list(APPEND TEST_SKIP_ANSI_TESTING
set(TEST_SKIP_ANSI_TESTING
cl_d3d10_h cl_d3d11_h cl_dx9_media_sharing_h cl_dx9_media_sharing_intel_h cl_icd_h cl_layer_h)
get_filename_component(LANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
if(LANG_DIR MATCHES cpp)
set(CPP_SOURCE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE}pp")
file(RELATIVE_PATH REL_SOURCE_PATH "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../${SOURCE}")
file(TO_NATIVE_PATH "${REL_SOURCE_PATH}" NATIVE_SOURCE_PATH)
file(WRITE
"${CPP_SOURCE_PATH}"
"#include \"${NATIVE_SOURCE_PATH}\"\n"
)
set(SOURCE_PATH "${CPP_SOURCE_PATH}")
set(LANG cpp)
else()
set(SOURCE_PATH "../${SOURCE}")
set(LANG c)
endif()
foreach(VERSION 100 110 120 200 210 220 300)
set(TEST_EXE ${NAME}_${LANG}_${VERSION})
list(FIND TEST_SKIP_ANSI_TESTING ${NAME} TEST_SKIP_INDEX)
if(NOT (${TEST_SKIP_INDEX} GREATER -1 AND MSVC AND CMAKE_C_FLAGS MATCHES "/Za"))
add_executable(${TEST_EXE} ${SOURCE})
add_executable(${TEST_EXE} "${SOURCE_PATH}")
target_compile_definitions(${TEST_EXE}
PUBLIC -DCL_TARGET_OPENCL_VERSION=${VERSION}
)
@ -20,21 +35,8 @@ function(add_header_test NAME SOURCE)
endforeach(VERSION)
endfunction(add_header_test)
# Tests
add_header_test(cl_h test_cl.h.c)
add_header_test(cl_d3d10_h test_cl_d3d10.h.c)
add_header_test(cl_d3d11_h test_cl_d3d11.h.c)
add_header_test(cl_dx9_media_sharing_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_dx9_media_sharing_intel_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_egl_h test_cl_egl.h.c)
add_header_test(cl_ext_h test_cl_ext.h.c)
add_header_test(cl_ext_intel_h test_cl_ext_intel.h.c)
add_header_test(cl_gl_h test_cl_gl.h.c)
add_header_test(cl_gl_ext_h test_cl_gl_ext.h.c)
add_header_test(cl_half_h test_cl_half.h.c)
add_header_test(cl_icd_h test_cl_icd.h.c)
add_header_test(cl_layer_h test_cl_layer.h.c)
add_header_test(cl_platform_h test_cl_platform.h.c)
add_header_test(cl_opencl_h test_opencl.h.c)
add_header_test(cl_version_h test_cl_version.h.c)
add_header_test(headers test_headers.c)
add_subdirectory(lang_c)
if(OPENCL_HEADERS_BUILD_CXX_TESTS)
enable_language(CXX)
add_subdirectory(lang_cpp)
endif()

View File

@ -0,0 +1,18 @@
# Tests
add_header_test(cl_h test_cl.h.c)
add_header_test(cl_d3d10_h test_cl_d3d10.h.c)
add_header_test(cl_d3d11_h test_cl_d3d11.h.c)
add_header_test(cl_dx9_media_sharing_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_dx9_media_sharing_intel_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_egl_h test_cl_egl.h.c)
add_header_test(cl_ext_h test_cl_ext.h.c)
add_header_test(cl_ext_intel_h test_cl_ext_intel.h.c)
add_header_test(cl_gl_h test_cl_gl.h.c)
add_header_test(cl_gl_ext_h test_cl_gl_ext.h.c)
add_header_test(cl_half_h test_cl_half.h.c)
add_header_test(cl_icd_h test_cl_icd.h.c)
add_header_test(cl_layer_h test_cl_layer.h.c)
add_header_test(cl_platform_h test_cl_platform.h.c)
add_header_test(cl_opencl_h test_opencl.h.c)
add_header_test(cl_version_h test_cl_version.h.c)
add_header_test(headers test_headers.c)

View File

@ -0,0 +1,18 @@
# Tests
add_header_test(cl_h test_cl.h.c)
add_header_test(cl_d3d10_h test_cl_d3d10.h.c)
add_header_test(cl_d3d11_h test_cl_d3d11.h.c)
add_header_test(cl_dx9_media_sharing_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_dx9_media_sharing_intel_h test_cl_dx9_media_sharing.h.c)
add_header_test(cl_egl_h test_cl_egl.h.c)
add_header_test(cl_ext_h test_cl_ext.h.c)
add_header_test(cl_ext_intel_h test_cl_ext_intel.h.c)
add_header_test(cl_gl_h test_cl_gl.h.c)
add_header_test(cl_gl_ext_h test_cl_gl_ext.h.c)
add_header_test(cl_half_h test_cl_half.h.c)
add_header_test(cl_icd_h test_cl_icd.h.c)
add_header_test(cl_layer_h test_cl_layer.h.c)
add_header_test(cl_platform_h test_cl_platform.h.c)
add_header_test(cl_opencl_h test_opencl.h.c)
add_header_test(cl_version_h test_cl_version.h.c)
add_header_test(headers test_headers.c)

View File

@ -95,7 +95,7 @@ int main(void)
CHECK_FROM_FLOAT(-(CL_HALF_MAX + 1000.f), 0xfbff, RTP);
CHECK_FROM_FLOAT(-(CL_HALF_MAX + 1000.f), 0xfc00, RTN);
CHECK_FROM_FLOAT(-(CL_HALF_MAX + 1000.f), 0xfbff, RTZ);
#ifndef _MSC_VER
#if 0 // Hexadecimal float constant is C++17
// Check tiny positive values round properly
CHECK_FROM_FLOAT(0x1.000000p-25, 0x0000, RTE);
CHECK_FROM_FLOAT(0x1.000000p-25, 0x0001, RTP);
@ -108,7 +108,7 @@ int main(void)
CHECK_FROM_FLOAT(-0x1.000000p-25, 0x8001, RTN);
CHECK_FROM_FLOAT(-0x1.000000p-25, 0x8000, RTZ);
#else
// Check tiny positive values round properly
// Check tiny positive values round properly
CHECK_FROM_FLOAT(2.98023223876953125e-08, 0x0000, RTE);
CHECK_FROM_FLOAT(2.98023223876953125e-08, 0x0001, RTP);
CHECK_FROM_FLOAT(2.98023223876953125e-08, 0x0000, RTN);