Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): replace -Wc++-compat' with -x c++'
Browse files Browse the repository at this point in the history
As of this commit, a build with CFLAGS="-x c++" succeeds; ie: all source
files in the tree are both valid C++ source code AND valid C code.

Convert wcpp-compat distcheck builds to actually build with C++, to
prevent future pull requests from breaking C++ compatibility going
forward.

stack-info: PR: aws#578, branch: aws-nslick/stack/25
Signed-off-by: Nicholas Sielicki <[email protected]>
aws-nslick committed Sep 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ce76d35 commit 2313bbf
Showing 2 changed files with 27 additions and 5 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/distcheck.yaml
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ jobs:
./configure --prefix=/opt/aws-ofi-nccl --with-mpi=/opt/amazon/openmpi \
--with-libfabric=/opt/amazon/efa \
--with-cuda=/usr/local/cuda \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-tests=no \
--enable-platform-aws
@@ -121,6 +122,9 @@ jobs:
cc:
- gcc
- clang
mode:
- cpp
- c
tracing:
- lttng
- none
@@ -136,7 +140,7 @@ jobs:
cc: gcc
cc-version: 13

name: u2204/${{ matrix.sdk }}/libfabric@git/${{matrix.cc}}(${{matrix.cc-variant}})/distcheck/
name: u2204/${{ matrix.sdk }}/libfabric@git/${{matrix.cc}}(${{matrix.cc-variant}})/distcheck(${{ matrix.mode }})/
steps:
- uses: actions/checkout@v4
- name: Configure Neuron SDK Repository
@@ -218,10 +222,12 @@ jobs:
./configure --with-mpi=/opt/amazon/openmpi \
--with-libfabric=/opt/amazon/efa \
--with-cuda=/usr/local/cuda/ \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-tests \
--enable-platform-aws
else
./configure --with-libfabric=/opt/amazon/efa \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-neuron \
--enable-platform-aws
fi
@@ -248,6 +254,9 @@ jobs:
cc:
- gcc
- clang
mode:
- cpp
- c
sdk:
- cuda
- neuron
@@ -259,7 +268,7 @@ jobs:
cc: gcc
cc-version: 13

name: u2204/${{ matrix.sdk }}/${{matrix.cc}}(${{matrix.cc-variant}})/unit-tests/
name: u2204/${{ matrix.sdk }}/${{matrix.cc}}(${{matrix.cc-variant}})/unit-tests(${{ matrix.mode }})/
steps:
- uses: actions/checkout@v4
- name: Configure Neuron SDK Repository
@@ -336,13 +345,15 @@ jobs:
./configure --with-mpi=/opt/amazon/openmpi \
--with-libfabric=/opt/amazon/efa \
--with-cuda=/usr/local/cuda/ \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-tests \
--enable-debug \
--enable-platform-aws
else
./configure --with-libfabric=/opt/amazon/efa \
--enable-neuron \
--enable-debug \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-platform-aws
fi
make -j "$(nproc)"
@@ -366,7 +377,10 @@ jobs:
sdk:
- cuda
- neuron
name: CodeChecker - ${{ matrix.sdk }}
mode:
- cpp
- c
name: CodeChecker - ${{ matrix.sdk }} ${{ matrix.mode }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -422,12 +436,14 @@ jobs:
./configure \
--with-libfabric="/opt/amazon/efa" \
--enable-neuron \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-platform-aws
else
./configure \
--with-libfabric="/opt/amazon/efa" \
--with-mpi="/opt/amazon/openmpi" \
--with-cuda=/usr/local/cuda/ \
--enable-cpp=${{ matrix.mode == 'cpp' && 'yes' || 'no' }} \
--enable-tests \
--enable-platform-aws
fi
@@ -446,7 +462,7 @@ jobs:
- name: Save CodeChecker HTML output.
uses: actions/upload-artifact@v4
with:
name: CodeChecker Bug Reports for ${{ matrix.sdk }}
name: CodeChecker Bug Reports for ${{ matrix.sdk }} ${{ matrix.mode }}
path: ${{ steps.codechecker.outputs.result-html-dir }}/*.html

- name: CodeChecker Pass Or Fail?
8 changes: 7 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ AC_DEFINE_UNQUOTED([OFI_NCCL_TRACE], [${trace}], [Defined to 1 unit test output
AC_ARG_ENABLE([picky-compiler],
[AS_HELP_STRING([--disable-picky-compiler], [Disable adding picky compiler flags.])])
AS_IF([test "${enable_picky_compiler}" != "no"],
[picky_compiler_flags="-Wall -Wc++-compat -Wextra -Wno-unused-parameter"
[picky_compiler_flags="-Wall -Wextra -Wno-unused-parameter"
AC_MSG_NOTICE([Adding ${picky_compiler_flags} to CFLAGS.])
CFLAGS="${CFLAGS} ${picky_compiler_flags}"
AS_UNSET([picky_compiler_flags])])
@@ -189,6 +189,12 @@ AS_IF([test -d "${srcdir}/.git" -a -z "${enable_werror}"],

AC_SUBST([NCCL_NET_OFI_DISTCHCK_CONFIGURE_FLAGS])

AC_ARG_ENABLE([cpp],
[AS_HELP_STRING([--enable-cpp], [(Developer) Enable building as C++ source. Off by default.])])
AS_IF([test "${enable_cpp}" = "yes"],
[AC_MSG_NOTICE([Building as C++ source.])
CFLAGS="${CFLAGS} -x c++ -std=c++17"])

AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile

0 comments on commit 2313bbf

Please sign in to comment.