Skip to content

Commit

Permalink
Add test to build all private headers individually
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Jul 11, 2023
1 parent 25b7a06 commit f9236ad
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 11 deletions.
34 changes: 34 additions & 0 deletions libcudacxx/.upstream-tests/maintenance/all-internal-headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

#this creates a set of tests, that ensures, that all itnernal headers can be build independently

set -e

internal_headers=$(find ../../include -path "*cuda/std/detail/libcxx/include/__*/*" -not -path "*/__cuda/*")

cd ../../test/libcxx/selftest/internal_headers

for f in $internal_headers
do
short_path=${f##*../include/}
test_name=${f##*include/}
test_name=${test_name%.h}.pass.cpp

mkdir -p -- "${test_name%/*}"
cat > $test_name << EOL
//===----------------------------------------------------------------------===//
//
// Part of libcu++, the C++ Standard Library for your entire system,
// under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/std/version>
#include <$short_path>
int main(int, char**) { return 0; }
EOL
done
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#include "../__assert"
#include "../__mdspan/extents.h"
#include "../__mdspan/layout_stride.h"
#include "../__mdspan/macros.h"
#include "../__type_traits/is_constructible.h"
#include "../__type_traits/is_convertible.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#endif // __cuda_std__

#include "../__mdspan/macros.h"
#include "../__utility/integer_sequence.h"

#if defined(_LIBCUDACXX_USE_PRAGMA_GCC_SYSTEM_HEADER)
#pragma GCC system_header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#endif // __cuda_std__

#include "../__type_traits/integral_constant.h"
#include "../__type_traits/is_arithmetic.h"
#include "../__type_traits/is_null_pointer.h"
#include "../__type_traits/is_void.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "../__type_traits/is_reference.h"
#include "../__type_traits/remove_reference.h"
#include "../__type_traits/remove_cvref.h"

#if defined(_LIBCUDACXX_USE_PRAGMA_GCC_SYSTEM_HEADER)
#pragma GCC system_header
Expand Down
24 changes: 13 additions & 11 deletions libcudacxx/include/cuda/std/detail/libcxx/include/exception
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ template <class E> void rethrow_if_nested(const E& e);

*/

#ifndef __cuda_std__
#include <__config>
#include <cstddef>
#include <cstdlib>
#include <type_traits>
#include <version>
#endif //__cuda_std__

#include "cstddef"
#include "cstdlib"
#include "type_traits"
#include "version"

#if defined(_LIBCUDACXX_ABI_VCRUNTIME)
#include <vcruntime_exception.h>
Expand All @@ -90,25 +93,24 @@ template <class E> void rethrow_if_nested(const E& e);
#pragma GCC system_header
#endif

namespace std // purposefully not using versioning namespace
{
_LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION // purposefully not using versioning namespace

#if !defined(_LIBCUDACXX_ABI_VCRUNTIME)
class _LIBCUDACXX_EXCEPTION_ABI exception
{
public:
_LIBCUDACXX_INLINE_VISIBILITY exception() _NOEXCEPT {}
virtual ~exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
_LIBCUDACXX_HOST_DEVICE virtual ~exception() _NOEXCEPT;
_LIBCUDACXX_HOST_DEVICE virtual const char* what() const _NOEXCEPT;
};

class _LIBCUDACXX_EXCEPTION_ABI bad_exception
: public exception
{
public:
_LIBCUDACXX_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
virtual ~bad_exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
_LIBCUDACXX_HOST_DEVICE virtual ~bad_exception() _NOEXCEPT;
_LIBCUDACXX_HOST_DEVICE virtual const char* what() const _NOEXCEPT;
};
#endif // !_LIBCUDACXX_ABI_VCRUNTIME

Expand Down Expand Up @@ -324,6 +326,6 @@ rethrow_if_nested(const _Ep&,
{
}

} // std
_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION

#endif // _LIBCUDACXX_EXCEPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public:
#endif //__cuda_std__

#include "__assert" // all public C++ headers provide the assertion handler
#include "cstdlib"
#include "iosfwd"

#ifndef __cuda_std__
Expand Down

0 comments on commit f9236ad

Please sign in to comment.