Added pp header to util library (#8814)
* Added pp header to util library * Fixed code style and typo * Fixed arm
This commit is contained in:
1 parent
387c35cc6e
commit
d01e6368ec
6 files changed
+55
-5
No files matched your search
@@ -403,7 +403,7 @@ struct ThrowNow final {
|
||||
# define IE_LOCATION ""
|
||||
#endif // NDEBUG
|
||||
|
||||
// WARNING: DO NOT USE THIS MACRO! Use openvino/pp.hpp macro library
|
||||
// WARNING: DO NOT USE THIS MACRO! Use openvino/util/pp.hpp macro library
|
||||
#define IE_PP_EXPAND(X) X
|
||||
#define IE_PP_NARG(...) IE_PP_EXPAND(IE_PP_NARG_(__VA_ARGS__, IE_PP_RSEQ_N()))
|
||||
#define IE_PP_NARG_(...) IE_PP_EXPAND(IE_PP_ARG_N(__VA_ARGS__))
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "ie_iextension.h"
|
||||
#include "ie_input_info.hpp"
|
||||
#include "ie_parameter.hpp"
|
||||
#include "openvino/pp.hpp"
|
||||
#include "openvino/util/pp.hpp"
|
||||
#include "so_ptr.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openvino/pp.hpp>
|
||||
#include <openvino/util/pp.hpp>
|
||||
#include <openvino/itt.hpp>
|
||||
|
||||
#define OV_CC_EXPAND OV_PP_EXPAND
|
||||
|
||||
@@ -10,7 +10,7 @@ add_library(${TARGET_NAME} STATIC ${SOURCES})
|
||||
|
||||
add_library(openvino::itt ALIAS ${TARGET_NAME})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::pp)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::pp openvino::util)
|
||||
|
||||
if(TARGET ittnotify)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC ittnotify)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <openvino/function_name.hpp>
|
||||
#include <openvino/pp.hpp>
|
||||
#include <openvino/util/pp.hpp>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Set of macro used by openvino
|
||||
* @file openvino/util/pp.hpp
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Macros for string conversion
|
||||
#define OV_PP_TOSTRING(...) OV_PP_TOSTRING_(__VA_ARGS__)
|
||||
#define OV_PP_TOSTRING_(...) #__VA_ARGS__
|
||||
|
||||
#define OV_PP_EXPAND(X) X
|
||||
|
||||
#define OV_PP_NARG(...) OV_PP_EXPAND(OV_PP_NARG_(__VA_ARGS__, OV_PP_RSEQ_N()))
|
||||
#define OV_PP_NARG_(...) OV_PP_EXPAND(OV_PP_ARG_N(__VA_ARGS__))
|
||||
#define OV_PP_ARG_N(_0, _1, _2, _3, _4, N, ...) N
|
||||
#define OV_PP_RSEQ_N() 0, 4, 3, 2, 1, 0
|
||||
#define OV_PP_NO_ARGS(NAME) , , , ,
|
||||
|
||||
// Macros for names concatenation
|
||||
#define OV_PP_CAT_(x, y) x##y
|
||||
#define OV_PP_CAT(x, y) OV_PP_CAT_(x, y)
|
||||
#define OV_PP_CAT3_(x, y, z) x##y##z
|
||||
#define OV_PP_CAT3(x, y, z) OV_PP_CAT3_(x, y, z)
|
||||
#define OV_PP_CAT4_(x, y, z, w) x##y##z##w
|
||||
#define OV_PP_CAT4(x, y, z, w) OV_PP_CAT4_(x, y, z, w)
|
||||
|
||||
#define OV_PP_OVERLOAD(NAME, ...) \
|
||||
OV_PP_EXPAND(OV_PP_CAT3(NAME, _, OV_PP_EXPAND(OV_PP_NARG(OV_PP_NO_ARGS __VA_ARGS__(NAME))))(__VA_ARGS__))
|
||||
|
||||
// Placeholder for first macro argument
|
||||
#define OV_PP_ARG_PLACEHOLDER_1 0,
|
||||
|
||||
// This macro returns second argument, first argument is ignored
|
||||
#define OV_PP_SECOND_ARG(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_(__VA_ARGS__, 0))
|
||||
#define OV_PP_SECOND_ARG_(...) OV_PP_EXPAND(OV_PP_SECOND_ARG_GET(__VA_ARGS__))
|
||||
#define OV_PP_SECOND_ARG_GET(ignored, val, ...) val
|
||||
|
||||
// Return macro argument value
|
||||
#define OV_PP_IS_ENABLED(x) OV_PP_IS_ENABLED1(x)
|
||||
|
||||
// Generate junk macro or {0, } sequence if val is 1
|
||||
#define OV_PP_IS_ENABLED1(val) OV_PP_IS_ENABLED2(OV_PP_CAT(OV_PP_ARG_PLACEHOLDER_, val))
|
||||
|
||||
// Return second argument from possible sequences {1, 0}, {0, 1, 0}
|
||||
#define OV_PP_IS_ENABLED2(arg1_or_junk) OV_PP_SECOND_ARG(arg1_or_junk 1, 0)
|
||||
Reference in new issue
Block a user