Skip to content

Commit

Permalink
CI checks for C compiler warnings (#528)
Browse files Browse the repository at this point in the history
Previously, we only checked for C compiler warnings when doing a local "development" build (`pip install --editable .`). Now, we also check in CI.

Co-authored-by: Bret Ambrose <[email protected]>
  • Loading branch information
graebm and Bret Ambrose authored Nov 21, 2023
1 parent e64cc82 commit 4c5cc5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"!cmake_args": [
"-DS2N_NO_PQ_ASM=ON"
],
"env": {
"AWS_CRT_BUILD_WARNINGS_ARE_ERRORS": "1"
},
"hosts": {
"manylinux": {
"_comment": "Use existing compiler on manylinux. These are the images we use for release. We want to be sure things work with the defaults.",
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,19 @@ def awscrt_ext():
extra_compile_args += ['-Wno-strict-aliasing', '-std=gnu99']

# treat warnings as errors in development mode
if is_development_mode():
if is_development_mode() or os.getenv('AWS_CRT_BUILD_WARNINGS_ARE_ERRORS') == '1':
extra_compile_args += ['-Wextra', '-Werror']

# ...except when we take shortcuts in development mode and don't make
# a proper MacOS Universal2 binary. The linker warns us about this,
# but WHATEVER. Building everything twice (x86_64 and arm64) takes too long.
if not is_macos_universal2():
extra_link_args += ['-Wl,-fatal_warnings']
if sys.platform == 'darwin':
extra_link_args += ['-Wl,-fatal_warnings']
elif 'bsd' in sys.platform:
extra_link_args += ['-Wl,-fatal-warnings']
else:
extra_link_args += ['-Wl,--fatal-warnings']

if sys.version_info >= (3, 11):
define_macros.append(('Py_LIMITED_API', '0x030B0000'))
Expand Down
5 changes: 2 additions & 3 deletions source/mqtt5_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ static bool s_py_topic_aliasing_options_init(
py_outbound_behavior,
"TopicAliasingOptions",
"outbound_behavior",
&topic_aliasing_options->outbound_topic_alias_behavior)) {
(int *)&topic_aliasing_options->outbound_topic_alias_behavior)) {
if (PyErr_Occurred()) {
goto done;
}
Expand All @@ -766,7 +766,7 @@ static bool s_py_topic_aliasing_options_init(
py_inbound_behavior,
"TopicAliasingOptions",
"inbound_behavior",
&topic_aliasing_options->inbound_topic_alias_behavior)) {
(int *)&topic_aliasing_options->inbound_topic_alias_behavior)) {
if (PyErr_Occurred()) {
goto done;
}
Expand Down Expand Up @@ -1204,7 +1204,6 @@ PyObject *aws_py_mqtt5_client_new(PyObject *self, PyObject *args) {
int will_payload_format_tmp = 0;
enum aws_mqtt5_payload_format_indicator will_payload_format_enum_tmp = 0;
uint32_t will_message_expiry_interval_seconds_tmp = 0;
uint16_t will_topic_alias_tmp = 0;
struct aws_byte_cursor will_correlation_data_tmp;
if (!PyObject_IsTrue(is_will_none_py)) {
will.qos = PyObject_GetIntEnum(will_qos_val_py, AWS_PYOBJECT_KEY_QOS);
Expand Down

0 comments on commit 4c5cc5e

Please sign in to comment.