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

Mac fixes #834

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Mac fixes #834

wants to merge 3 commits into from

Conversation

snej
Copy link

@snej snej commented Dec 1, 2023

Description

Fixed issues using doctest on macOS. Each fix is in a separate commit.

The existing platform checks assumed that <TargetConditionals.h> was
already included prior to doctest.h. If it wasn't, DOCTEST_PLATFORM_MAC
wouldn't get set because doctest was checking for macros defined in
that header.

This caused issues in cross-platform code being run/tested on an
Apple platform; I first noticed that breakpoints on CHECK didn't work.

Since the comment above said "this is how Catch does it", I went to
a recent version of Catch and copied/adapted its platform check,
which does work properly. I changed it a bit because there's no real
need to distinguish between macOS and iOS or other Apple platforms
(AFAIK) since they work the same under the hood; DOCTEST_PLATFORM_MAC
will be set on any Apple platform. If there's a need to specialize,
there are several other macros in TargetConditionals.h that can be
checked.
Copied the ARM assembly instruction from Catch2 v3.
It works on my M2 MacBook Pro :)
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d7a5eeb) 92.11% compared to head (e270ddd) 92.11%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #834   +/-   ##
=======================================
  Coverage   92.11%   92.11%           
=======================================
  Files           2        2           
  Lines        2168     2168           
=======================================
  Hits         1997     1997           
  Misses        171      171           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@snej
Copy link
Author

snej commented Dec 2, 2023

Hm, the Windows clang builds fail with an error I’ve never seen before, in code I didn’t touch:

2023-12-01T19:14:13.0706185Z D:/a/doctest/doctest/doctest/parts\doctest_fwd.h:617:47: error: unsafe buffer access [-Werror,-Wunsafe-buffer-usage]
2023-12-01T19:14:13.0707209Z     bool isOnStack() const noexcept { return (buf[last] & 128) == 0; }

I see #824 has exactly the same errors, so this isn’t a regression from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant