Skip to content

Commit

Permalink
simplify visibility_control files
Browse files Browse the repository at this point in the history
Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
M. Fatih Cırıt committed Oct 11, 2022
1 parent 26422fa commit ec09776
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 58 deletions.
35 changes: 6 additions & 29 deletions common/autoware_node/include/autoware_node/visibility_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,12 @@
#ifndef AUTOWARE_NODE__VISIBILITY_CONTROL_HPP_
#define AUTOWARE_NODE__VISIBILITY_CONTROL_HPP_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define AUTOWARE_NODE_EXPORT __attribute__((dllexport))
#define AUTOWARE_NODE_IMPORT __attribute__((dllimport))
#else
#define AUTOWARE_NODE_EXPORT __declspec(dllexport)
#define AUTOWARE_NODE_IMPORT __declspec(dllimport)
#endif
#ifdef AUTOWARE_NODE_BUILDING_LIBRARY
#define AUTOWARE_NODE_PUBLIC AUTOWARE_NODE_EXPORT
#else
#define AUTOWARE_NODE_PUBLIC AUTOWARE_NODE_IMPORT
#endif
#define AUTOWARE_NODE_PUBLIC_TYPE AUTOWARE_NODE_PUBLIC
#define AUTOWARE_NODE_LOCAL
#else
#define AUTOWARE_NODE_EXPORT __attribute__((visibility("default")))
#define AUTOWARE_NODE_IMPORT
#if __GNUC__ >= 4
#define AUTOWARE_NODE_PUBLIC __attribute__((visibility("default")))
#define AUTOWARE_NODE_LOCAL __attribute__((visibility("hidden")))
#include "rcutils/visibility_control_macros.h"
#ifdef AUTOWARE_NODE_BUILDING_DLL
#define AUTOWARE_NODE_PUBLIC RCUTILS_EXPORT
#else
#define AUTOWARE_NODE_PUBLIC
#define AUTOWARE_NODE_LOCAL
#endif
#define AUTOWARE_NODE_PUBLIC_TYPE
#endif
#define AUTOWARE_NODE_PUBLIC RCUTILS_IMPORT
#endif // !AUTOWARE_NODE_BUILDING_DLL
#define AUTOWARE_NODE_LOCAL RCUTILS_LOCAL

#endif // AUTOWARE_NODE__VISIBILITY_CONTROL_HPP_
35 changes: 6 additions & 29 deletions common/test_node/include/test_node/visibility_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,12 @@
#ifndef TEST_NODE__VISIBILITY_CONTROL_HPP_
#define TEST_NODE__VISIBILITY_CONTROL_HPP_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define TEST_NODE_EXPORT __attribute__((dllexport))
#define TEST_NODE_IMPORT __attribute__((dllimport))
#else
#define TEST_NODE_EXPORT __declspec(dllexport)
#define TEST_NODE_IMPORT __declspec(dllimport)
#endif
#ifdef TEST_NODE_BUILDING_LIBRARY
#define TEST_NODE_PUBLIC TEST_NODE_EXPORT
#else
#define TEST_NODE_PUBLIC TEST_NODE_IMPORT
#endif
#define TEST_NODE_PUBLIC_TYPE TEST_NODE_PUBLIC
#define TEST_NODE_LOCAL
#else
#define TEST_NODE_EXPORT __attribute__((visibility("default")))
#define TEST_NODE_IMPORT
#if __GNUC__ >= 4
#define TEST_NODE_PUBLIC __attribute__((visibility("default")))
#define TEST_NODE_LOCAL __attribute__((visibility("hidden")))
#include "rcutils/visibility_control_macros.h"
#ifdef TEST_NODE_BUILDING_DLL
#define TEST_NODE_PUBLIC RCUTILS_EXPORT
#else
#define TEST_NODE_PUBLIC
#define TEST_NODE_LOCAL
#endif
#define TEST_NODE_PUBLIC_TYPE
#endif
#define TEST_NODE_PUBLIC RCUTILS_IMPORT
#endif // !TEST_NODE_BUILDING_DLL
#define TEST_NODE_LOCAL RCUTILS_LOCAL

#endif // TEST_NODE__VISIBILITY_CONTROL_HPP_

0 comments on commit ec09776

Please sign in to comment.