-
Notifications
You must be signed in to change notification settings - Fork 446
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
[POC RFC] header only API for singletons (Windows) #1595
Closed
Closed
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ef23861
WIP
marcalff d231197
WIP
marcalff 7c52d4b
Testing tentative fix for windows
marcalff 6a8f2ff
Disable unit test for windows
marcalff c81cc34
Partial revert of:
marcalff 84d6bab
format
marcalff 5de5b6a
format
marcalff cbf70a7
Alternate implementation for windows.
marcalff 5aeeb74
Fixed windows build break.
marcalff c6a8970
Merge branch 'open-telemetry:main' into poc_api_singletons_1520_b
marcalff 556b592
Fix code review comments,
marcalff a4fa08e
Merge branch 'open-telemetry:main' into poc_api_singletons_1520_b
marcalff b5b6552
Tentative, to test on CI:
marcalff 868b6b0
Tentative,
marcalff 4d11eac
Merge branch 'main' into poc_api_singletons_1520_b
marcalff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ if(WITH_LOGS_PREVIEW) | |
endif() | ||
add_subdirectory(common) | ||
add_subdirectory(baggage) | ||
add_subdirectory(singleton) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# FIXME: visibility("hidden") / visibility("default") compiling options. | ||
|
||
DEFAULT_WIN_COPTS = [ | ||
] | ||
|
||
# gcc and clang, assumed to be used on this platform | ||
DEFAULT_NOWIN_COPTS = [ | ||
"-fvisibility=default", | ||
] | ||
|
||
HIDDEN_WIN_COPTS = [ | ||
] | ||
|
||
# gcc and clang, assumed to be used on this platform | ||
HIDDEN_NOWIN_COPTS = [ | ||
"-fvisibility=hidden", | ||
] | ||
|
||
cc_library( | ||
name = "component_a", | ||
srcs = [ | ||
"component_a.cc", | ||
], | ||
hdrs = [ | ||
"component_a.h", | ||
], | ||
linkstatic = True, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "component_b", | ||
srcs = [ | ||
"component_b.cc", | ||
], | ||
hdrs = [ | ||
"component_b.h", | ||
], | ||
linkstatic = True, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "component_c", | ||
srcs = [ | ||
"component_c.cc", | ||
], | ||
hdrs = [ | ||
"component_c.h", | ||
], | ||
copts = select({ | ||
"//bazel:windows": DEFAULT_WIN_COPTS, | ||
"//conditions:default": DEFAULT_NOWIN_COPTS, | ||
}), | ||
linkstatic = False, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "component_d", | ||
srcs = [ | ||
"component_d.cc", | ||
], | ||
hdrs = [ | ||
"component_d.h", | ||
], | ||
copts = select({ | ||
"//bazel:windows": HIDDEN_WIN_COPTS, | ||
"//conditions:default": HIDDEN_NOWIN_COPTS, | ||
}), | ||
linkstatic = False, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "component_e", | ||
srcs = [ | ||
"component_e.cc", | ||
], | ||
hdrs = [ | ||
"component_e.h", | ||
], | ||
copts = select({ | ||
"//bazel:windows": DEFAULT_WIN_COPTS, | ||
"//conditions:default": DEFAULT_NOWIN_COPTS, | ||
}), | ||
linkstatic = False, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "component_f", | ||
srcs = [ | ||
"component_f.cc", | ||
], | ||
hdrs = [ | ||
"component_f.h", | ||
], | ||
copts = select({ | ||
"//bazel:windows": HIDDEN_WIN_COPTS, | ||
"//conditions:default": HIDDEN_NOWIN_COPTS, | ||
}), | ||
linkstatic = False, | ||
deps = [ | ||
"//api", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "singleton_test", | ||
srcs = [ | ||
"singleton_test.cc", | ||
], | ||
linkstatic = False, | ||
tags = [ | ||
"api", | ||
"test", | ||
], | ||
deps = [ | ||
"component_a", | ||
"component_b", | ||
"component_c", | ||
"component_d", | ||
"component_e", | ||
"component_f", | ||
"//api", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering why
__declspec(selectany)
is removed?Doesn't it work with MSVC on Windows?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owent
__declspec(selectany)
works when applied to a member.This PR tested applying it to a method, which failed to compile.
See places where
OPENTELEMETRY_API_SINGLETON
is used in this patch,which are different compared to PR#1525
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also add
__declspec(selectany)
to variables, so we can also support dll on Windows with MSVC?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owent, see file macros.h in the latest push.