build: set -O3 and tune WinCE in CI, fix getpart, vtls_scache fallouts

- GHA/windows/WinCE:
  - set `-O3 -DNDEBUG` C flags manually for the CMake mingw32ce build.
    CMake doesn't recognize the platform and fails to add them. To match
    autotools (using `-O2`), and hit similar compiler warnings.
  - enable parallel builds for cmake.
  - tune parallelism for cmake using unity batches.
  - tune parallelism for autotools.

  Follow-up to 2a292c3984 #15975

- tests: fix potentially uninitialized value in `readline()` in
  `getpart.c`. Detected by gcc 4.4.0 `-O2` (Windows CE) jobs:
  ```
  tests/server/getpart.c: In function 'getpart':
  tests/server/getpart.c:298: error: 'datalen' may be used uninitialized in this function
  ```
  Ref: https://github.com/curl/curl/actions/runs/13522595237/job/37785147505?pr=16476#step:11:25
  Follow-up to 592880a3ca

- vtls_scache: rework returning pointer to avoid compiler warning seen
  with `-O3` gcc 4.4.0 builds (Windows CE/schannel):
  ```
  lib/vtls/schannel.c: In function 'schannel_connect_step1':
  lib/vtls/vtls_scache.c:975: error: dereferencing pointer 'old_cred.4474' does break strict-aliasing rules
  lib/vtls/vtls_scache.c:985: error: dereferencing pointer 'old_cred.4474' does break strict-aliasing rules
  lib/vtls/schannel.c:959: note: initialized from here
  ```
  Ref: https://github.com/curl/curl/actions/runs/13523868335/job/37789610845#step:9:25
  Follow-up to fa0ccd9f1f #15774

Closes #16476
This commit is contained in:
Viktor Szakats 2025-02-25 14:38:41 +01:00
parent 4f98f354b1
commit c028a243f2
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 28 additions and 26 deletions

View file

@ -593,6 +593,7 @@ jobs:
timeout-minutes: 10
env:
toolchain-version: '0.59.1'
MAKEFLAGS: -j 4
strategy:
matrix:
build: [autotools, cmake]
@ -629,12 +630,13 @@ jobs:
-DCMAKE_SYSTEM_NAME=WindowsCE \
-DCMAKE_SYSTEM_VERSION=8.0 \
-DCMAKE_SYSTEM_PROCESSOR=arm \
-DCMAKE_C_FLAGS='-O3 -DNDEBUG' \
-DCMAKE_C_COMPILER_TARGET=arm-mingw32ce \
-DCMAKE_C_COMPILER=arm-mingw32ce-gcc \
-DCMAKE_RC_COMPILER=arm-mingw32ce-windres \
-DMINGW32CE_LIBRARY_DIR="$HOME/opt/mingw32ce/arm-mingw32ce/lib" \
-DCMAKE_IGNORE_PREFIX_PATH="$(brew --prefix)" \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=50 -DCURL_TEST_BUNDLES=ON \
-DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_STATIC_CURL=OFF \
-DCURL_WERROR=ON \
-DCURL_USE_SCHANNEL=ON \
@ -663,7 +665,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld
else
make -j5 -C bld
make -C bld
fi
- name: 'curl info'
@ -677,7 +679,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
make -C bld -C tests
fi
- name: 'build examples'
@ -687,7 +689,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
make -C bld examples
fi
msvc: