diff --git a/.ci-builds/.azure-exhaustive-tests.yml b/.ci-builds/.azure-exhaustive-tests.yml index 48b9d7ad23c6..2f3550bfa337 100644 --- a/.ci-builds/.azure-exhaustive-tests.yml +++ b/.ci-builds/.azure-exhaustive-tests.yml @@ -65,7 +65,7 @@ jobs: lfs: true fetchDepth: 10 - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 displayName: 'Build' - script: | cd icu4c/source && make check-exhaustive diff --git a/.ci-builds/.azure-pipelines.yml b/.ci-builds/.azure-pipelines.yml index ebcbe731916d..e00a588b44ae 100644 --- a/.ci-builds/.azure-pipelines.yml +++ b/.ci-builds/.azure-pipelines.yml @@ -36,7 +36,7 @@ jobs: lfs: true fetchDepth: 10 - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 check + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 check displayName: 'Build and Test' env: CC: clang @@ -62,7 +62,7 @@ jobs: # calling makeconv for it, although the Makefile has appropriate dependencies. - script: | cd icu4c/source && \ - ICU_DATA_FILTER_FILE=../../.ci-builds/data-filter.json ./runConfigureICU Linux && \ + ICU_DATA_FILTER_FILE=../../.ci-builds/data-filter.json ./runConfigureICU Linux/clang && \ make -j2 tests && \ \[ ! -d data/out/build/icudt66l/translit \] && \ (cd test/intltest && LD_LIBRARY_PATH=../../lib:../../tools/ctestfw ./intltest translit/TransliteratorTest/TestBasicTransliteratorEvenWithoutData) && \ @@ -82,7 +82,7 @@ jobs: lfs: true fetchDepth: 10 - script: | - export CXXFLAGS="-std=c++17 -Winvalid-constexpr" && cd icu4c/source && ./runConfigureICU --enable-debug --disable-release Linux && make -j -l2.5 check + export CXXFLAGS="-std=c++17 -Winvalid-constexpr" && cd icu4c/source && ./runConfigureICU --enable-debug --disable-release Linux/clang && make -j -l2.5 check displayName: 'Build and Test C++17' env: CC: clang @@ -136,7 +136,7 @@ jobs: lfs: true fetchDepth: 10 - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 check + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 check displayName: 'Build and Test' env: CC: clang @@ -160,7 +160,7 @@ jobs: sudo apt install -qy clang-16 lld-16 libc++-16-dev libc++abi-16-dev displayName: 'Install Clang-16' - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 tests + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 tests displayName: 'Build only (WarningsAsErrors)' env: CC: clang-16 @@ -184,7 +184,7 @@ jobs: sudo apt install -qy clang-16 lld-16 libc++-16-dev libc++abi-16-dev displayName: 'Install Clang-16' - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 check + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 check displayName: 'Build and Test' env: CC: clang-16 @@ -209,7 +209,7 @@ jobs: sudo apt install -qy clang-16 lld-16 libc++-16-dev libc++abi-16-dev displayName: 'Install Clang-16' - script: | - cd icu4c/source && ./runConfigureICU Linux && make -j -l2.5 check + cd icu4c/source && ./runConfigureICU Linux/clang && make -j -l2.5 check displayName: 'Build and Test' env: CC: clang-16 diff --git a/.github/workflows/icu4c.yml b/.github/workflows/icu4c.yml index e085d2ac0a87..793eb421bd08 100644 --- a/.github/workflows/icu4c.yml +++ b/.github/workflows/icu4c.yml @@ -87,7 +87,7 @@ jobs: CXXFLAGS: -Wimplicit-fallthrough run: | cd icu4c/source; - ./runConfigureICU Linux; + ./runConfigureICU Linux/clang; make -j -l2.5 check; - name: Test Dependency run: | @@ -122,7 +122,7 @@ jobs: - name: Build ICU4C with clang run: | cd icu4c/source; - ./runConfigureICU Linux ${{ matrix.build_option }}; + ./runConfigureICU Linux/clang ${{ matrix.build_option }}; make -j -l2.5 tests; - name: Test run: | @@ -159,7 +159,7 @@ jobs: - name: ICU4C with clang and asan run: | cd icu4c/source; - ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming --enable-tracing; + ./runConfigureICU --enable-debug --disable-release Linux/clang --disable-renaming --enable-tracing; make -j -l2.5 check; env: CPPFLAGS: -fsanitize=address @@ -173,7 +173,7 @@ jobs: - name: ICU4C with clang and ubsan +alignment run: | cd icu4c/source; - ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming; + ./runConfigureICU --enable-debug --disable-release Linux/clang --disable-renaming; make -j -l2.5 check; env: CPPFLAGS: -fsanitize=undefined -fsanitize=alignment -fno-sanitize-recover=undefined,alignment @@ -188,7 +188,7 @@ jobs: - name: ICU4C with clang using CFI run: | cd icu4c/source; - ./runConfigureICU Linux --disable-renaming; + ./runConfigureICU Linux/clang --disable-renaming; make -j -l2.5 check; env: CC: clang @@ -207,7 +207,7 @@ jobs: - name: ICU4C with clang and tsan run: | cd icu4c/source; - ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming + ./runConfigureICU --enable-debug --disable-release Linux/clang --disable-renaming make -j -l2.5; make -j -l2.5 -C test; make -j -l2.5 -C test/intltest check diff --git a/.github/workflows/icu_valgrind.yml b/.github/workflows/icu_valgrind.yml index 0f5a2c8f4b34..9d669261f6f0 100644 --- a/.github/workflows/icu_valgrind.yml +++ b/.github/workflows/icu_valgrind.yml @@ -40,7 +40,7 @@ jobs: CXXFLAGS: -gdwarf-4 run: | cd icu4c/source; - ./runConfigureICU --enable-debug Linux --disable-renaming && make -j -l2.5 tests; + ./runConfigureICU --enable-debug Linux/clang --disable-renaming && make -j -l2.5 tests; - name: Test iotest with valgrind run: | cd icu4c/source/test/iotest @@ -85,7 +85,7 @@ jobs: CXXFLAGS: -gdwarf-4 run: | cd icu4c/source; - ./runConfigureICU --enable-debug Linux --disable-renaming && make -j -l2.5 tests; + ./runConfigureICU --enable-debug Linux/clang --disable-renaming && make -j -l2.5 tests; - name: Check all top path in intltest is covered run: | cd icu4c/source/test/intltest; diff --git a/docs/devsetup/cpp/index.md b/docs/devsetup/cpp/index.md index 25ec3a87342d..0df2ed852dc6 100644 --- a/docs/devsetup/cpp/index.md +++ b/docs/devsetup/cpp/index.md @@ -70,7 +70,7 @@ For example: --disable-release Linux --prefix=/home/*your_user_name*/icu/mine/inst > config.out 2>&1` * build: make -j5 check > out.txt 2>&1 - * Be sure to test with gcc and g++ too! `CC=gcc CXX=g++ + * Be sure to test with both gcc/g++ and clang/clang++! `CC=clang CXX=clang++ CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" ../../src/icu4c/source/runConfigureICU --enable-debug --disable-release diff --git a/docs/devsetup/cpp/linux.md b/docs/devsetup/cpp/linux.md index beb39f7fd643..b31b02f62ac4 100644 --- a/docs/devsetup/cpp/linux.md +++ b/docs/devsetup/cpp/linux.md @@ -81,7 +81,7 @@ the configure options for building ICU with the address checker: ``` CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address ./runConfigureICU ---enable-debug --disable-release Linux --disable-renaming +--enable-debug --disable-release Linux/clang --disable-renaming ``` The other available sanitizers are `thread`, `memory` and `undefined` behavior. diff --git a/docs/processes/release/tasks/healthy-code.md b/docs/processes/release/tasks/healthy-code.md index 3f0649a99e0a..a4bc4b6f3125 100644 --- a/docs/processes/release/tasks/healthy-code.md +++ b/docs/processes/release/tasks/healthy-code.md @@ -605,7 +605,7 @@ tests. These instructions run the sanitizer on the entire test suite. The clang compiler is required. ```sh -$ CPPFLAGS=-fsanitize=thread LDFLAGS=-fsanitize=thread ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming +$ CPPFLAGS=-fsanitize=thread LDFLAGS=-fsanitize=thread ./runConfigureICU --enable-debug --disable-release Linux/clang --disable-renaming $ make clean $ make -j -l2.5 check ``` diff --git a/docs/processes/release/tasks/integration.md b/docs/processes/release/tasks/integration.md index 892deb894cf9..b36d2717e36c 100644 --- a/docs/processes/release/tasks/integration.md +++ b/docs/processes/release/tasks/integration.md @@ -431,7 +431,7 @@ To run manually, on a Linux system with clang, ```sh cd icu4c/source -CPPFLAGS=-fsanitize=thread LDFLAGS=-fsanitize=thread ./runConfigureICU --enable-debug --disable-release Linux +CPPFLAGS=-fsanitize=thread LDFLAGS=-fsanitize=thread ./runConfigureICU --enable-debug --disable-release Linux/clang make clean make -j -l2.5 check ``` @@ -449,7 +449,7 @@ To run manually, on a Linux system with clang, ```sh cd icu4c/source -CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address ./runConfigureICU --enable-debug --disable-release Linux +CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address ./runConfigureICU --enable-debug --disable-release Linux/clang make clean make -j -l2.5 check ``` diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac index b7531b8ace42..0ee8afa4cd00 100644 --- a/icu4c/source/configure.ac +++ b/icu4c/source/configure.ac @@ -147,10 +147,8 @@ AC_SUBST(ENABLE_RELEASE) : ${CXXFLAGS=""} # Checks for compilers -AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc]) -# Make sure that we try clang++ first, which provides C++17 support. -# The g++ compiler is less likely to support C++17. -AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC]) +AC_PROG_CC([cc clang gcc c99 c89 xlc_r xlc cl.exe icc]) +AC_PROG_CXX([c++ clang++ g++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC]) # pkg-config is needed for harfbuzz support PKG_PROG_PKG_CONFIG([0.20]) diff --git a/icu4c/source/runConfigureICU b/icu4c/source/runConfigureICU index 00a56872979f..7909c98358a5 100755 --- a/icu4c/source/runConfigureICU +++ b/icu4c/source/runConfigureICU @@ -46,7 +46,8 @@ The following names can be supplied as the argument for platform: FreeBSD Use the clang/clang++ or GNU gcc/g++ compilers on FreeBSD HP-UX/ACC Use the HP ANSI C/Advanced C++ compilers on HP-UX 11 IBMi Use the iCC compilers on IBM i, i5/OS, OS/400 - Linux Use the clang/clang++ or GNU gcc/g++ compilers on Linux + Linux Use the default cc/c++ compilers on Linux + Linux/clang Use the clang/clang++ compilers on Linux Linux/gcc Use the GNU gcc/g++ compilers on Linux Linux/ECC Use the Intel ECC compiler on Linux Linux/ICC Use the Intel ICC compiler on Linux @@ -259,9 +260,19 @@ case $platform in DEBUG_CFLAGS='-g' DEBUG_CXXFLAGS='-g' ;; + Linux/clang) + THE_OS="Linux" + THE_COMP="the Clang C++" + CC=clang; export CC + CXX=clang++; export CXX + RELEASE_CFLAGS='-O3' + RELEASE_CXXFLAGS='-O3' + DEBUG_CFLAGS='-g' + DEBUG_CXXFLAGS='-g' + ;; Linux*) THE_OS="Linux" - THE_COMP="the clang or else GNU C++" + THE_COMP="the default C++" RELEASE_CFLAGS='-O3' RELEASE_CXXFLAGS='-O3' DEBUG_CFLAGS='-g'