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

Add a backport of std::string_view #13

Merged
merged 16 commits into from
Dec 17, 2019
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@
*.exe
*.out
*.app

# Bazel files
/bazel-*
19 changes: 19 additions & 0 deletions 3rd_party/catch2/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])

cc_library(
name = "catch2",
hdrs = [
"include/opentelemetry/3rd_party/catch.hpp",
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might be useful for a test that wants to define its own main, but I removed for now so that there's only catch2_with_main

],
strip_include_prefix = "include",
)

cc_library(
name = "catch2_with_main",
srcs = [
"catch2_main.cpp",
],
deps = [
":catch2",
],
)
23 changes: 23 additions & 0 deletions 3rd_party/catch2/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions 3rd_party/catch2/catch2_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#define CATCH_CONFIG_MAIN

#include "opentelemetry/3rd_party/catch.hpp"
Copy link
Member

Choose a reason for hiding this comment

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

I don't see the main function, do I miss anything? If it is based on the macro you can just do it in the build rule to set the 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.

It's from the macro, yes.

You might have a situation like this

// a_test_helper.cc
#include "opentelemetry/3rd_party/catch.hpp"
... <define some helper functions>

// a_test.cc
#include "a_test_helper.h"
#include "opentelemetry/3rd_party/catch.hpp"
... <define tests>

If the macro definition gets propagated to both source files when they get compiled, you'll have two mains.

Loading