Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change #pragma once to include guards. #2372

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_1_HPP
#define DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_1_HPP

#include <charconv>

Expand Down Expand Up @@ -295,3 +296,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_fixed_precision_to_chars_
// Ryu Printf d2fixed_test.cc D2fixedTest Regression
{7.018232e-82, chars_format::fixed, 6, "0.000000"},
};

#endif // DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_1_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_2_HPP
#define DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_2_HPP

#include <charconv>

Expand Down Expand Up @@ -3472,3 +3473,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_fixed_precision_to_chars_
"4966972117251561159028374314008832830700919814604603127166450293302718569748969958855904333838446616500117"
"8426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336"},
};

#endif // DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_2_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_3_HPP
#define DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_3_HPP

#include <charconv>

Expand Down Expand Up @@ -10827,3 +10828,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_fixed_precision_to_chars_
"2984927294793703708001158120333242616861941586246075606910029233718147847851055755750691813753282576963131"
"0693972479511748662180221113394836543075210717029725044946195117678217681054268005181200990732288"},
};

#endif // DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_3_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_4_HPP
#define DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_4_HPP

#include <charconv>

Expand Down Expand Up @@ -10806,3 +10807,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_fixed_precision_to_chars_
"5895351438246423432132688946418276846754670353751698604991057655128207624549009038932894407586850845513394"
"2304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368"},
};

#endif // DOUBLE_FIXED_PRECISION_TO_CHARS_TEST_CASES_4_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef DOUBLE_FROM_CHARS_TEST_CASES_HPP
#define DOUBLE_FROM_CHARS_TEST_CASES_HPP

#include <charconv>
#include <stddef.h>
Expand Down Expand Up @@ -1639,3 +1640,5 @@ inline constexpr DoubleFromCharsTestCase double_from_chars_test_cases[] = {
"62881473913110540827237163350510684586298239947245938479716304835356329624224137216",
chars_format::fixed, 309, errc::result_out_of_range, double_inf},
};

#endif // DOUBLE_FROM_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef DOUBLE_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP
#define DOUBLE_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -5058,3 +5059,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_general_precision_to_char
{0x1.f8b0f962cdffbp+205, chars_format::general, 51, "1.01375957392225305727423222620636224221808910954041e+62"},
{0x1.f8b0f962cdffbp+205, chars_format::general, 55, "1.013759573922253057274232226206362242218089109540405973e+62"},
};

#endif // DOUBLE_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef DOUBLE_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP
#define DOUBLE_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -115,3 +116,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_hex_precision_to_chars_te
{0x1.801p+0, chars_format::hex, 0, "2p+0"},
{0x1.900p+0, chars_format::hex, 0, "2p+0"},
};

#endif // DOUBLE_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_1_HPP
#define DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_1_HPP

#include <charconv>

Expand Down Expand Up @@ -322,3 +323,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_scientific_precision_to_c
{0x1.f8b0f962cdffbp+205, chars_format::scientific, 54,
"1.013759573922253057274232226206362242218089109540405973e+62"},
};

#endif // DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_1_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_2_HPP
#define DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_2_HPP

#include <charconv>

Expand Down Expand Up @@ -3214,3 +3215,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_scientific_precision_to_c
"9669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178"
"426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336e+308"},
};

#endif // DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_2_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_3_HPP
#define DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_3_HPP

#include <charconv>

Expand Down Expand Up @@ -10120,3 +10121,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_scientific_precision_to_c
"9849272947937037080011581203332426168619415862460756069100292337181478478510557557506918137532825769631310"
"693972479511748662180221113394836543075210717029725044946195117678217681054268005181200990732288e+308"},
};

#endif // DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_3_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_4_HPP
#define DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_4_HPP

#include <charconv>

Expand Down Expand Up @@ -10102,3 +10103,5 @@ inline constexpr DoublePrecisionToCharsTestCase double_scientific_precision_to_c
"8953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942"
"304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368e+308"},
};

#endif // DOUBLE_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_4_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef DOUBLE_TO_CHARS_TEST_CASES_HPP
#define DOUBLE_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -2919,3 +2920,5 @@ inline constexpr DoubleToCharsTestCase double_to_chars_test_cases[] = {
{0x1p-569, chars_format::scientific, "5.17526350329881e-172"},
{0x1p-645, chars_format::scientific, "6.84940421565126e-195"},
};

#endif // DOUBLE_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef FLOAT_FIXED_PRECISION_TO_CHARS_TEST_CASES_HPP
#define FLOAT_FIXED_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -1259,3 +1260,5 @@ inline constexpr FloatPrecisionToCharsTestCase float_fixed_precision_to_chars_te
{0x1.fffffep+126f, chars_format::fixed, 0, "170141173319264429905852091742258462720"},
{0x1.fffffep+127f, chars_format::fixed, 0, "340282346638528859811704183484516925440"},
};

#endif // FLOAT_FIXED_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef FLOAT_FROM_CHARS_TEST_CASES_HPP
#define FLOAT_FROM_CHARS_TEST_CASES_HPP

#include <charconv>
#include <stddef.h>
Expand Down Expand Up @@ -255,3 +256,5 @@ inline constexpr FloatFromCharsTestCase float_from_chars_test_cases[] = {
{"7.fffffffp+125", chars_format::hex, 14, errc::result_out_of_range, float_inf},
{"8.0000000p+125", chars_format::hex, 14, errc::result_out_of_range, float_inf},
};

#endif // FLOAT_FROM_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef FLOAT_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP
#define FLOAT_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -1213,3 +1214,5 @@ inline constexpr FloatPrecisionToCharsTestCase float_general_precision_to_chars_
{0x1.2ced34p+126f, chars_format::general, 39, "100000006944061726476491472742798852096"},
{0x1.fffffep+127f, chars_format::general, 39, "340282346638528859811704183484516925440"},
};

#endif // FLOAT_GENERAL_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef FLOAT_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP
#define FLOAT_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -101,3 +102,5 @@ inline constexpr FloatPrecisionToCharsTestCase float_hex_precision_to_chars_test
{0x1.801p+0f, chars_format::hex, 0, "2p+0"},
{0x1.900p+0f, chars_format::hex, 0, "2p+0"},
};

#endif // FLOAT_HEX_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef FLOAT_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_HPP
#define FLOAT_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -1088,3 +1089,5 @@ inline constexpr FloatPrecisionToCharsTestCase float_scientific_precision_to_cha
{0x1.fffffep+126f, chars_format::scientific, 37, "1.7014117331926442990585209174225846272e+38"},
{0x1.fffffep+127f, chars_format::scientific, 37, "3.4028234663852885981170418348451692544e+38"},
};

#endif // FLOAT_SCIENTIFIC_PRECISION_TO_CHARS_TEST_CASES_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
// (Keep the cgmanifest.json commitHash in sync.)


#pragma once
#ifndef FLOAT_TO_CHARS_TEST_CASES_HPP
#define FLOAT_TO_CHARS_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -544,3 +545,5 @@ inline constexpr FloatToCharsTestCase float_to_chars_test_cases[] = {
{0x1p87f, chars_format::scientific, "1.5474251e+26"},
{0x1p-96f, chars_format::scientific, "1.2621775e-29"},
};

#endif // FLOAT_TO_CHARS_TEST_CASES_HPP
5 changes: 4 additions & 1 deletion tests/std/tests/P0067R5_charconv/test.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef TEST_HPP
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filename is quite short to the include guard isn't too unique.
Since MSVC STL uses #pragma once in their other tests there's no conflict with the other test.hpp files.
At libc++'s side and it's no issue there.

Are you happy with this short name or should I include the directory name? In that case I think it makes sense to do that to all files just to be consistent.

Copy link
Member

@CaseyCarter CaseyCarter Dec 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very short, but I didn't complain since the scope of these headers is just this single test. If test.hpp is a sufficiently-descriptive name, then TEST_HPP is almost certainly a sufficiently-unique header guard macro.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine by me. I wanted to point out this short name so it the attention of the reviewers. Thanks for the review!

#define TEST_HPP

#include <charconv>
#include <limits>
Expand Down Expand Up @@ -77,3 +78,5 @@ struct DoublePrecisionToWideTestCase {
int precision;
const wchar_t* correct;
};

#endif // TEST_HPP
5 changes: 4 additions & 1 deletion tests/std/tests/P0067R5_charconv/wchar_test_cases.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef WCHAR_TEST_CASES_HPP
#define WCHAR_TEST_CASES_HPP

#include <charconv>

Expand Down Expand Up @@ -165,3 +166,5 @@ inline constexpr FloatToWideTestCase float_to_wide_test_cases[] = {
// {0x1.729p-1f, chars_format::hex, L"1.729p-1"},
// {-0x1.729p-1f, chars_format::hex, L"-1.729p-1"},
};

#endif // WCHAR_TEST_CASES_HPP