Skip to content

Suppress build warnings#156

Open
rgommers wants to merge 3 commits into
explosion:mainfrom
rgommers:suppress-build-warnings
Open

Suppress build warnings#156
rgommers wants to merge 3 commits into
explosion:mainfrom
rgommers:suppress-build-warnings

Conversation

@rgommers
Copy link
Copy Markdown
Contributor

(1) Suppress discarded-qualifiers warnings in Cython extensions
The const pointer wrappers (dgemm, sgemm, saxpy, daxpy) call fused-type
functions that can't express const, producing -Wdiscarded-qualifiers
warnings. Suppress with both the gcc and clang flag variants, and add
-Wno-unknown-warning-option so clang doesn't warn about the gcc flag.

(2) Also suppress -Wunused-function warnings, they show up on macOS
(not on Linux).

(3) Use an SPDX expression for the license instead of a deprecated trove classifier

license warning content
         ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: BSD License

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

Overall this should cut the length of CI logs roughly in half.

@rgommers
Copy link
Copy Markdown
Contributor Author

rgommers commented Apr 1, 2026

A few more. On Ubuntu arm64 (log):

  building 'blis.py' extension
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/project/include -I/project/blis/_src/include/linux-cortexa57 -I/tmp/build-env-oc1u2921/include -I/opt/_internal/cpython-3.10.19/include/python3.10 -I/tmp/build-env-oc1u2921/lib/python3.10/site-packages/numpy/_core/include -c blis/py.c -o build/temp.linux-aarch64-cpython-310/blis/py.o -std=c99 -Wno-unknown-warning-option -Wno-discarded-qualifiers -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function
  In file included from /tmp/build-env-oc1u2921/lib/python3.10/site-packages/numpy/_core/include/numpy/ndarraytypes.h:1913,
                   from /tmp/build-env-oc1u2921/lib/python3.10/site-packages/numpy/_core/include/numpy/ndarrayobject.h:12,
                   from /tmp/build-env-oc1u2921/lib/python3.10/site-packages/numpy/_core/include/numpy/arrayobject.h:5,
                   from blis/py.c:1145:
  /tmp/build-env-oc1u2921/lib/python3.10/site-packages/numpy/_core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     17 | #warning "Using deprecated NumPy API, disable it with " \
        |  ^~~~~~~
  blis/py.c: In function ‘__Pyx_PyCode_New.constprop’:
  blis/py.c:43011:20: note: parameter passing for argument of type ‘__Pyx_PyCode_New_function_description’ changed in GCC 9.1
  43011 |   static PyObject* __Pyx_PyCode_New(
        |                    ^~~~~~~~~~~~~~~~
  blis/py.c: At top level:
  cc1: note: unrecognized command-line option ‘-Wno-incompatible-pointer-types-discards-qualifiers’ may have been intended to silence earlier diagnostics
  cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics

On macOS arm64 (log), lots of this:

ld: warning: object file (/Users/runner/work/cython-blis/cython-blis/z/bli_util_tapi_ex.o) was built for newer 'macOS' version (15.0) than being linked (11.0)
ld: warning: object file (/Users/runner/work/cython-blis/cython-blis/z/bli_util_unb_var1.o) was built for newer 'macOS' version (15.0) than being linked (11.0)
ld: warning: ignoring file 'z/bli_cntx_init_generic.o': found architecture 'arm64', required architecture 'x86_64'
ld: warning: ignoring file 'z/bli_cntx_generic_ref.o': found architecture 'arm64', required architecture 'x86_64'

On Windows (log), deprecation warnings for strncpy and getenv usage in blis sources:

Details
 C:\Program Files\LLVM\bin\clang.exe -c D:\a\cython-blis\cython-blis\blis\_src\frame\base\bli_clock.c -o C:\Users\RUNNER~1\AppData\Local\Temp\tmpjkgo4xg0\bli_clock.o -O3 -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.7.0" -DBLIS_IS_BUILDING_LIBRARY -Iinclude\windows-x86_64 -I.\frame\3\ -I.\frame\ind\ukernels\ -I.\frame\3\ -I.\frame\1m\ -I.\frame\1f\ -I.\frame\1\ -I.\frame\include -ID:\a\cython-blis\cython-blis\blis\_src\include\windows-x86_64
D:\a\cython-blis\cython-blis\blis\_src\frame\base\bli_cpuid.c:957:3: warning: 'strncpy' is deprecated: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
  957 |                 strncpy( model_num, loc+1, 4 );
      |                 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\string.h:334:1: note: 'strncpy' has been explicitly marked deprecated here
  334 | __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(
      | ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\corecrt.h:1974:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX'
 1974 |                 _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
      |                 ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:368:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
  368 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
      |                                                       ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:358:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
  358 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
      |                                               ^
1 warning generated.
D:\a\cython-blis\cython-blis\blis\_src\frame\base\bli_env.c:46:8: warning: 'getenv' is deprecated: This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
   46 |         str = getenv( env );
      |               ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\stdlib.h:1183:20: note: 'getenv' has been explicitly marked deprecated here
 1183 |     _Check_return_ _CRT_INSECURE_DEPRECATE(_dupenv_s)
      |                    ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:368:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
  368 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
      |                                                       ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:358:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
  358 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
      |                                               ^
1 warning generated.

rgommers and others added 3 commits April 1, 2026 12:34
Replace the deprecated "License :: OSI Approved :: BSD License"
classifier with the SPDX license identifier "BSD-3-Clause".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The const pointer wrappers (dgemm, sgemm, saxpy, daxpy) call fused-type
functions that can't express const, producing -Wdiscarded-qualifiers
warnings. Suppress with both the gcc and clang flag variants, and add
-Wno-unknown-warning-option so clang doesn't warn about the gcc flag.

Also suppress `-Wunused-function` warnings, they show up on macOS
(not on Linux).

Finally suppress a warning for `py.pyx` about using deprecated NumPy
C API (should be harmless, but good to avoid it).

Overall this should cut the length of CI logs roughly in half.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BLIS objects are compiled via raw subprocess calls that don't inherit
Python's deployment target, defaulting to the SDK version (e.g. 15.0).
When distutils links the extension with a lower target (e.g. 11.0),
the linker warns about version mismatches. Fix by setting
MACOSX_DEPLOYMENT_TARGET from sysconfig before compiling.

Avoids lots of warnings like this in the regular macOS CI jobs:
```
ld: warning: object file (.../bli_cntx_init_generic.o) was built for newer 'macOS' version (15.0) than being linked (11.0)
```

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rgommers rgommers force-pushed the suppress-build-warnings branch from fa21d14 to 6e7f646 Compare April 1, 2026 15:38
@rgommers rgommers closed this May 14, 2026
@rgommers rgommers reopened this May 14, 2026
@rgommers
Copy link
Copy Markdown
Contributor Author

Close/reopen to re-run CI, after some other build fixes were just merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant