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

Cut FOLLY_USE_CPP14_CONSTEXPR and FOLLY_CPP14_CONSTEXPR #1029

Closed

Conversation

JoeLoser
Copy link
Contributor

@JoeLoser JoeLoser commented Feb 21, 2019

Summary:

  • FOLLY_USE_CPP14_CONSTEXPR macro is not needed as Folly requires a
    recent enough version of MSVC where its constexpr support is "good
    enough". For Clang and GCC, the min compiler versions supported would
    both evaluate the prior implementation of this macro to true in both
    cases. This is potentially slightly behavior changing since
    FOLLY_USE_CPP14_CONSTEXPR would be inline for ICC and I am not
    sure if its constexpr support is "good enough" for a min version of
    ICC we claim support for.
  • Replace FOLLY_CPP14_CONSTEXPR with constexpr in all call sites and
    remove the FOLLY_CPP14_CONSTEXPR macro.
  • Simplify how we define FOLLY_STORAGE_CONSTEXPR and
    FOLLY_STORAGE_CPP14_CONSTEXPR after cutting
    FOLLY_USE_CPP14_CONSTEXPR.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

folly/Portability.h Outdated Show resolved Hide resolved
@JoeLoser JoeLoser force-pushed the cut_folly_use_cpp14_constexpr branch from a1c4fae to af1544e Compare February 23, 2019 23:21
@JoeLoser JoeLoser changed the title Cut FOLLY_USE_CPP14_CONSTEXPR Cut FOLLY_USE_CPP14_CONSTEXPR and FOLLY_CPP14_CONSTEXPR Feb 23, 2019
@JoeLoser
Copy link
Contributor Author

JoeLoser commented Feb 23, 2019

This is potentially behavior-changing for ICC since FOLLY_USE_CPP14_CONSTEXPR may define to 0 for some versions of ICC we may still support? I don't know if Folly makes any guarantees of min compiler versions of ICC supported. But, given a8b6dd7, you may want to run CI internally with some projects relying on ICC to determine breakage earlier rather than later.

I preserve the value of FOLLY_STORAGE_CONSTEXPR to define to nothing in the case of ICC, but FOLLY_USE_CPP14_CONSTEXPR will now define to constexpr, where before, for some versions of ICC may have defined to inline.

folly/Portability.h Outdated Show resolved Hide resolved
Summary:
- `FOLLY_USE_CPP14_CONSTEXPR` macro is not needed as Folly requires a
  recent enough version of MSVC where its constexpr support is "good
  enough". For Clang and GCC, the min compiler versions supported would
  both evaluate the prior implementation of this macro to true in both
  cases.
- Replace `FOLLY_CPP14_CONSTEXPR` with `constexpr` in all call sites and
  remove the `FOLLY_CPP14_CONSTEXPR` macro.
- Rename `FOLLY_STORAGE_CPP14_CONSTEXPR` to `FOLLY_STORAGE_CONSTEXPR`.
@JoeLoser JoeLoser force-pushed the cut_folly_use_cpp14_constexpr branch from af1544e to d26d226 Compare February 23, 2019 23:43
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

sandraiser pushed a commit to sandraiser/folly that referenced this pull request Mar 4, 2019
Summary:
- `FOLLY_USE_CPP14_CONSTEXPR` macro is not needed as Folly requires a
  recent enough version of MSVC where its constexpr support is "good
  enough". For Clang and GCC, the min compiler versions supported would
  both evaluate the prior implementation of this macro to true in both
  cases. This is potentially slightly behavior changing since
  `FOLLY_USE_CPP14_CONSTEXPR` would be `inline` for ICC and I am not
  sure if its constexpr support is "good enough" for a min version of
  ICC we claim support for.
- Replace `FOLLY_CPP14_CONSTEXPR` with `constexpr` in all call sites and
  remove the `FOLLY_CPP14_CONSTEXPR` macro.
- Simplify how we define `FOLLY_STORAGE_CONSTEXPR` and
  `FOLLY_STORAGE_CPP14_CONSTEXPR` after cutting
  `FOLLY_USE_CPP14_CONSTEXPR`.
Pull Request resolved: facebook#1029

Reviewed By: Orvid

Differential Revision: D14199538

Pulled By: yfeldblum

fbshipit-source-id: 99daecf7d7ad0c4bf6735e74247112a78923602a
@JoeLoser JoeLoser deleted the cut_folly_use_cpp14_constexpr branch April 2, 2019 00:57
ahornby added a commit to ahornby/folly that referenced this pull request Jul 15, 2024
Summary:

These were [failing on github](https://github.com/facebook/folly/actions/runs/9923539772/job/27413784313#step:43:30071)

 * Fix use of regex in test in FsUtilTest.cpp
 * Treat MSVC like APPLE in folly::current_exception() to fix ExceptionTest
 * Fix lookup of executable path on windows, which was breaking SSL test

Test Plan:
```
python build/fbcode_builder/getdeps.py build --src-dir=. folly
python build/fbcode_builder/getdeps.py test folly
```

before, broken:
```
1/6 Test  facebook#941: ssl_session_test.SSLSessionTest.BasicTest ...................***Failed    0.03 sec
Note: Google Test filter = SSLSessionTest.BasicTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from SSLSessionTest
[ RUN      ] SSLSessionTest.BasicTest
unknown file: error: C++ exception with description "boost::filesystem::read_symlink: The system cannot find the path specified [system:3]: "/proc/self/exe"" thrown in SetUp().
[  FAILED  ] SSLSessionTest.BasicTest (4 ms)
[----------] 1 test from SSLSessionTest (4 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (4 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SSLSessionTest.BasicTest

 1 FAILED TEST

    Start  942: ssl_session_test.SSLSessionTest.NullSessionResumptionTest
2/6 Test  facebook#936: HHWheelTimerTest.HHWheelTimerTest.GetTimeRemaining ..........   Passed    0.06 sec
    Start 1029: lang_exception_test.ExceptionTest.current_exception
3/6 Test  facebook#942: ssl_session_test.SSLSessionTest.NullSessionResumptionTest ...***Failed    0.04 sec
Note: Google Test filter = SSLSessionTest.NullSessionResumptionTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from SSLSessionTest
[ RUN      ] SSLSessionTest.NullSessionResumptionTest
unknown file: error: C++ exception with description "boost::filesystem::read_symlink: The system cannot find the path specified [system:3]: "/proc/self/exe"" thrown in SetUp().
[  FAILED  ] SSLSessionTest.NullSessionResumptionTest (6 ms)
[----------] 1 test from SSLSessionTest (6 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (7 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SSLSessionTest.NullSessionResumptionTest

 1 FAILED TEST

4/6 Test  facebook#839: fs_util_test.Simple.UniquePathDefaultModel ..................***Failed    0.08 sec
Note: Google Test filter = Simple.UniquePathDefaultModel
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Simple
[ RUN      ] Simple.UniquePathDefaultModel
5/6 Test facebook#1029: lang_exception_test.ExceptionTest.current_exception .........***Failed    0.02 sec
Note: Google Test filter = ExceptionTest.current_exception
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ExceptionTest
[ RUN      ] ExceptionTest.current_exception
D:\a\folly\folly\folly\lang\test\ExceptionTest.cpp(238): error: Expected equality of these values:
  std::current_exception()
    Which is: 16-byte object <20-44 C1-6B 9B-01 00-00 10-44 C1-6B 9B-01 00-00>
  folly::current_exception()
    Which is: 16-byte object <30-3B C1-6B 9B-01 00-00 20-3B C1-6B 9B-01 00-00>
D:\a\folly\folly\folly\lang\test\ExceptionTest.cpp(247): error: Expected equality of these values:
  std::current_exception()
    Which is: 16-byte object <40-3F C1-6B 9B-01 00-00 30-3F C1-6B 9B-01 00-00>
  folly::current_exception()
    Which is: 16-byte object <20-44 C1-6B 9B-01 00-00 10-44 C1-6B 9B-01 00-00>
[  FAILED  ] ExceptionTest.current_exception (0 ms)
[----------] 1 test from ExceptionTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ExceptionTest.current_exception

 1 FAILED TEST

6/6 Test  facebook#838: fs_util_test.Simple.UniquePath ..............................***Failed    0.12 sec
Note: Google Test filter = Simple.UniquePath
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Simple
[ RUN      ] Simple.UniquePath
```

After, works:
```
1920/1920 Test  facebook#813: parallel_test.ParallelTest.PSum ......................................................................   Passed   66.92 sec

100% tests passed, 0 tests failed out of 1919

Total Test time (real) =  67.02 sec

The following tests did not run:
        1348 - atomic_unordered_map_test.AtomicUnorderedInsertMap.MegaMap (Disabled)
```
facebook-github-bot pushed a commit that referenced this pull request Jul 15, 2024
Summary:
These were [failing on github](https://github.com/facebook/folly/actions/runs/9923539772/job/27413784313#step:43:30071)

 * Fix use of regex in test in FsUtilTest.cpp
 * MSVC std::current_exception() exception_ptr return values are not comparable, was breaking ExceptionTest
 * Fix lookup of executable path on windows, which was breaking SSL test

Pull Request resolved: #2256

Test Plan:
```
python build/fbcode_builder/getdeps.py build --src-dir=. folly
python build/fbcode_builder/getdeps.py test folly
```

before, broken:
```
1/6 Test  #941: ssl_session_test.SSLSessionTest.BasicTest ...................***Failed    0.03 sec
Note: Google Test filter = SSLSessionTest.BasicTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from SSLSessionTest
[ RUN      ] SSLSessionTest.BasicTest
unknown file: error: C++ exception with description "boost::filesystem::read_symlink: The system cannot find the path specified [system:3]: "/proc/self/exe"" thrown in SetUp().
[  FAILED  ] SSLSessionTest.BasicTest (4 ms)
[----------] 1 test from SSLSessionTest (4 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (4 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SSLSessionTest.BasicTest

 1 FAILED TEST

    Start  942: ssl_session_test.SSLSessionTest.NullSessionResumptionTest
2/6 Test  #936: HHWheelTimerTest.HHWheelTimerTest.GetTimeRemaining ..........   Passed    0.06 sec
    Start 1029: lang_exception_test.ExceptionTest.current_exception
3/6 Test  #942: ssl_session_test.SSLSessionTest.NullSessionResumptionTest ...***Failed    0.04 sec
Note: Google Test filter = SSLSessionTest.NullSessionResumptionTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from SSLSessionTest
[ RUN      ] SSLSessionTest.NullSessionResumptionTest
unknown file: error: C++ exception with description "boost::filesystem::read_symlink: The system cannot find the path specified [system:3]: "/proc/self/exe"" thrown in SetUp().
[  FAILED  ] SSLSessionTest.NullSessionResumptionTest (6 ms)
[----------] 1 test from SSLSessionTest (6 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (7 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SSLSessionTest.NullSessionResumptionTest

 1 FAILED TEST

4/6 Test  #839: fs_util_test.Simple.UniquePathDefaultModel ..................***Failed    0.08 sec
Note: Google Test filter = Simple.UniquePathDefaultModel
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Simple
[ RUN      ] Simple.UniquePathDefaultModel
5/6 Test #1029: lang_exception_test.ExceptionTest.current_exception .........***Failed    0.02 sec
Note: Google Test filter = ExceptionTest.current_exception
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ExceptionTest
[ RUN      ] ExceptionTest.current_exception
D:\a\folly\folly\folly\lang\test\ExceptionTest.cpp(238): error: Expected equality of these values:
  std::current_exception()
    Which is: 16-byte object <20-44 C1-6B 9B-01 00-00 10-44 C1-6B 9B-01 00-00>
  folly::current_exception()
    Which is: 16-byte object <30-3B C1-6B 9B-01 00-00 20-3B C1-6B 9B-01 00-00>
D:\a\folly\folly\folly\lang\test\ExceptionTest.cpp(247): error: Expected equality of these values:
  std::current_exception()
    Which is: 16-byte object <40-3F C1-6B 9B-01 00-00 30-3F C1-6B 9B-01 00-00>
  folly::current_exception()
    Which is: 16-byte object <20-44 C1-6B 9B-01 00-00 10-44 C1-6B 9B-01 00-00>
[  FAILED  ] ExceptionTest.current_exception (0 ms)
[----------] 1 test from ExceptionTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ExceptionTest.current_exception

 1 FAILED TEST

6/6 Test  #838: fs_util_test.Simple.UniquePath ..............................***Failed    0.12 sec
Note: Google Test filter = Simple.UniquePath
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Simple
[ RUN      ] Simple.UniquePath
```

After, works:
```
1920/1920 Test  #813: parallel_test.ParallelTest.PSum ......................................................................   Passed   66.92 sec

100% tests passed, 0 tests failed out of 1919

Total Test time (real) =  67.02 sec

The following tests did not run:
        1348 - atomic_unordered_map_test.AtomicUnorderedInsertMap.MegaMap (Disabled)
```

Reviewed By: ndmitchell

Differential Revision: D59751594

Pulled By: ahornby

fbshipit-source-id: 6822abeb3ab73abd4643c2c680855f8f7ba61dbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants