-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
b/309847996 b/329683364 Refactor c++17 flags from all platforms used while building cobalt into a central place "default_cpp_standard" in starboard/build/config/BUILD.gn Remove default config while compiling c++20 audit, add "cpp20_supported_config" in it's place. Co-author: andrewsavage1 --------- Co-authored-by: Andrew Savage <[email protected]>
- Loading branch information
1 parent
aecd26d
commit 3f45e5c
Showing
10 changed files
with
138 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2024 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the aLicense is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <numeric> | ||
#include <string> | ||
#include <string_view> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace starboard { | ||
namespace nplb { | ||
namespace compiler_compliance { | ||
namespace { | ||
|
||
// These examples are taken after referring to | ||
// 1) C++20 allowlist from chromium m114 milestone branch : | ||
// https://chromium.googlesource.com/chromium/src/+/refs/branch-heads/5735/styleguide/c++/c++-features.md | ||
// 2) cpp reference : https://en.cppreference.com/w/cpp | ||
|
||
// Test std::string ends_with support | ||
void test_string_ends_with() { | ||
bool result = std::string("foobar").ends_with("bar"); | ||
} | ||
|
||
// Test std::erase_if support | ||
void test_erase_if() { | ||
std::vector<char> cnt(10); | ||
std::iota(cnt.begin(), cnt.end(), '0'); | ||
std::erase(cnt, '3'); | ||
std::erase_if(cnt, [](char x) { return (x - '0') % 2 == 0; }); | ||
} | ||
|
||
// Test std::midpoint support | ||
void test_midpoint() { | ||
std::uint32_t a = std::numeric_limits<std::uint32_t>::max(); | ||
std::uint32_t b = std::numeric_limits<std::uint32_t>::max() - 2; | ||
std::midpoint(a, b); | ||
} | ||
|
||
// Test designated initializers | ||
void test_designated_initializer() { | ||
struct S { | ||
int x = 1; | ||
int y = 2; | ||
}; | ||
S s{.y = 3}; // OK, s.x == 1, s.y == 3 | ||
} | ||
|
||
} // namespace | ||
} // namespace compiler_compliance | ||
} // namespace nplb | ||
} // namespace starboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters