Skip to content

Compatibility fix GSL_SUPPRESS not working with clang-cl.exe #739

Closed

Description

@Farwaykorse

When building with clang-cl on Windows, the compatibility fix for clang is not used.

clang-cl.exe defines both the macros _MSC_VER and __clang__.
But the compatibility fix, as added with #703, checks for _MSC_VER first.

Applies to:
include/gsl/gsl_byte
include/gsl/gsl_assert

clang v7.0.0

Activity

  1. beinhaerter commented on Oct 12, 2018

    @beinhaerter
    Contributor

    Related: https://stackoverflow.com/questions/38499462/how-to-tell-clang-to-stop-pretending-to-be-other-compilers

    What bothers me: why do the unit tests compile with clang 3.x/4/5/6 (https://travis-ci.org/Microsoft/GSL/builds/415282747?utm_source=github_status&utm_medium=notification) but you cannot compile with clang 7? The linked StackOverflow question is two years old when clang 7 was not released. So the problem that you face should also be seen in the unit tests.

  2. Farwaykorse commented on Oct 15, 2018

    @Farwaykorse
    ContributorAuthor

    Werner Henze (@beinhaerter) Because all these tests were performed with clang++ on Mac and Linux.
    This happens when using clang-cl.exe, clang's compatible replacement for cl.exe.
    Clang-cl is Windows only and the default when used from Visual Studio.

    See also: https://clang.llvm.org/docs/UsersManual.html#clang-cl
    And: https://blogs.msdn.microsoft.com/vcblog/2018/09/18/exploring-clang-tooling-part-0-building-your-code-with-clang/

  3. added 2 commits that reference this issue on Oct 15, 2018
    6dd10aa
    419ea60
  4. beinhaerter commented on Oct 15, 2018

    @beinhaerter
    Contributor

    So question to the maintainers: is it possible to add clang-cl to the unit tests?

  5. annagrin commented on Nov 6, 2018

    @annagrin

    sure, it should be possible to modify appveyor.yml to add clang-cl tests. Contributions to tests are very appreciated!

  6. added
    Help Wanted
    on Nov 6, 2018
  7. added a commit that references this issue on Oct 12, 2025
    6418b5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions