Skip to content

Commit

Permalink
Consolidate visibility control macros (#1738)
Browse files Browse the repository at this point in the history
There is no need to have one per toolkit.

This also removes the MSVC-specific check because we don't build there
and we don't have any of the visibility compiler switches set for it,
either.
  • Loading branch information
hainest committed May 3, 2024
1 parent 95b6a50 commit 67bc82c
Show file tree
Hide file tree
Showing 176 changed files with 1,265 additions and 1,412 deletions.
1 change: 1 addition & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(_public_headers
h/dyn_regs.h
h/dyn_syscalls.h
h/dyntypes.h
h/dyninst_visibility.h
h/Edge.h
h/entryIDs.h
h/Graph.h
Expand Down
12 changes: 6 additions & 6 deletions common/h/Annotatable.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
namespace Dyninst
{

COMMON_EXPORT bool annotation_debug_flag();
COMMON_EXPORT int annotatable_printf(const char *format, ...)
DYNINST_EXPORT bool annotation_debug_flag();
DYNINST_EXPORT int annotatable_printf(const char *format, ...)
DYNINST_PRINTF_ANNOTATION(1, 2);

typedef unsigned short AnnotationClassID;
Expand All @@ -60,7 +60,7 @@ typedef bool (*anno_cmp_func_t)(void *, void*);
extern int newAnnotationClass();
extern bool void_ptr_cmp_func(void *, void *);

class COMMON_EXPORT AnnotationClassBase
class DYNINST_EXPORT AnnotationClassBase
{
private:
static std::vector<AnnotationClassBase *> *annotation_types;
Expand Down Expand Up @@ -127,9 +127,9 @@ typedef enum {
sp_rem_cont_item = 5
} ser_post_op_t;

COMMON_EXPORT const char *serPostOp2Str(ser_post_op_t);
DYNINST_EXPORT const char *serPostOp2Str(ser_post_op_t);

class COMMON_EXPORT AnnotatableDense
class DYNINST_EXPORT AnnotatableDense
{
typedef void *anno_list_t;

Expand Down Expand Up @@ -334,7 +334,7 @@ class COMMON_EXPORT AnnotatableDense

#define AN_INLINE inline

class COMMON_EXPORT AnnotatableSparse
class DYNINST_EXPORT AnnotatableSparse
{
public:
struct void_ptr_hasher
Expand Down
2 changes: 1 addition & 1 deletion common/h/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Dyninst {
// Dyninst internal codeGen structure that aims to be more user-friendly. Tiers 2 and 3
// are TODO.

class COMMON_EXPORT Buffer {
class DYNINST_EXPORT Buffer {
public:
Buffer(Address addr, unsigned initial_size);
Buffer();
Expand Down
4 changes: 2 additions & 2 deletions common/h/DynAST.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class name : public AST { \
Children kids_; \
} \

class COMMON_EXPORT AST : public boost::enable_shared_from_this<AST> {
class DYNINST_EXPORT AST : public boost::enable_shared_from_this<AST> {
public:

// This is a global list of all AST types, including those that are not
Expand Down Expand Up @@ -234,7 +234,7 @@ class COMMON_EXPORT AST : public boost::enable_shared_from_this<AST> {
virtual bool isStrictEqual(const AST &rhs) const = 0;
};

class COMMON_EXPORT ASTVisitor {
class DYNINST_EXPORT ASTVisitor {
public:
typedef boost::shared_ptr<AST> ASTPtr;

Expand Down
4 changes: 2 additions & 2 deletions common/h/Edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Dyninst {
class Graph;
class Node;

class COMMON_EXPORT Edge : public AnnotatableSparse {
class DYNINST_EXPORT Edge : public AnnotatableSparse {
friend class Node;
friend class Graph;
friend class Creator;
Expand Down Expand Up @@ -82,7 +82,7 @@ class COMMON_EXPORT Edge : public AnnotatableSparse {

class EdgeIteratorImpl;

class COMMON_EXPORT EdgeIterator {
class DYNINST_EXPORT EdgeIterator {
friend class Node;
friend class Graph;
friend class Edge;
Expand Down
2 changes: 1 addition & 1 deletion common/h/Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Node;
class NodeIterator;
class EdgeIterator;

class COMMON_EXPORT Graph : public AnnotatableSparse {
class DYNINST_EXPORT Graph : public AnnotatableSparse {
friend class Edge;
friend class Node;
friend class Creator;
Expand Down
2 changes: 1 addition & 1 deletion common/h/MachSyscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace ProcControlAPI
MachSyscall makeFromID(boost::shared_ptr<Process> proc, unsigned long id);
}

class COMMON_EXPORT MachSyscall
class DYNINST_EXPORT MachSyscall
{
public:
typedef unsigned long SyscallIDPlatform;
Expand Down
8 changes: 4 additions & 4 deletions common/h/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Graph;
class NodeIterator;
class EdgeIterator;

class COMMON_EXPORT Node {
class DYNINST_EXPORT Node {
friend class Edge;
friend class Graph;

Expand Down Expand Up @@ -114,7 +114,7 @@ class COMMON_EXPORT Node {
static const Address INVALID_ADDR;
};

class COMMON_EXPORT PhysicalNode : public Node {
class DYNINST_EXPORT PhysicalNode : public Node {
public:
typedef boost::shared_ptr<PhysicalNode> Ptr;

Expand All @@ -136,7 +136,7 @@ class COMMON_EXPORT PhysicalNode : public Node {
Address addr_;
};

class COMMON_EXPORT VirtualNode : public Node {
class DYNINST_EXPORT VirtualNode : public Node {
friend class Edge;
friend class Graph;

Expand Down Expand Up @@ -166,7 +166,7 @@ class COMMON_EXPORT VirtualNode : public Node {

class NodeIteratorImpl;

class COMMON_EXPORT NodeIterator {
class DYNINST_EXPORT NodeIterator {
friend class Node;
friend class Graph;
friend class Edge;
Expand Down
4 changes: 2 additions & 2 deletions common/h/SymReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct SymSegment {
* that the underlying implementation could be made re-enterant safe (so it
* could be called from a signal handler).
**/
class COMMON_EXPORT SymReader
class DYNINST_EXPORT SymReader
{
protected:
SymReader() {}
Expand Down Expand Up @@ -123,7 +123,7 @@ class COMMON_EXPORT SymReader

};

class COMMON_EXPORT SymbolReaderFactory
class DYNINST_EXPORT SymbolReaderFactory
{
public:
SymbolReaderFactory() {}
Expand Down
4 changes: 2 additions & 2 deletions common/h/VariableLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef enum {
storageRegOffset
} storageClass;

COMMON_EXPORT const char *storageClass2Str(storageClass sc);
DYNINST_EXPORT const char *storageClass2Str(storageClass sc);

/*
* storageRefClass: Encodes if a variable can be accessed through a register/address.
Expand All @@ -66,7 +66,7 @@ typedef enum {
storageNoRef
} storageRefClass;

COMMON_EXPORT const char *storageRefClass2Str(storageRefClass sc);
DYNINST_EXPORT const char *storageRefClass2Str(storageRefClass sc);

//location for a variable
//Use mr_reg instead of reg for new code. reg left in for backwards
Expand Down
16 changes: 8 additions & 8 deletions common/h/concurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
namespace Dyninst {

namespace dyn_c_annotations {
void COMMON_EXPORT rwinit(void*);
void COMMON_EXPORT rwdeinit(void*);
void COMMON_EXPORT wlock(void*);
void COMMON_EXPORT wunlock(void*);
void COMMON_EXPORT rlock(void*);
void COMMON_EXPORT runlock(void*);
void DYNINST_EXPORT rwinit(void*);
void DYNINST_EXPORT rwdeinit(void*);
void DYNINST_EXPORT wlock(void*);
void DYNINST_EXPORT wunlock(void*);
void DYNINST_EXPORT rlock(void*);
void DYNINST_EXPORT runlock(void*);
}

namespace concurrent {
Expand Down Expand Up @@ -207,7 +207,7 @@ class dyn_mutex : public boost::mutex {
using unique_lock = boost::unique_lock<dyn_mutex>;
};

class COMMON_EXPORT dyn_rwlock {
class DYNINST_EXPORT dyn_rwlock {
// Reader management members
boost::atomic<unsigned int> rin;
boost::atomic<unsigned int> rout;
Expand All @@ -234,7 +234,7 @@ class COMMON_EXPORT dyn_rwlock {
using shared_lock = boost::shared_lock<dyn_rwlock>;
};

class COMMON_EXPORT dyn_thread {
class DYNINST_EXPORT dyn_thread {
public:
dyn_thread();
unsigned int getId();
Expand Down
36 changes: 36 additions & 0 deletions common/h/dyninst_visibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* See the dyninst/COPYRIGHT file for copyright information.
*
* We provide the Paradyn Tools (below described as "Paradyn")
* on an AS IS basis, and do not warrant its validity or performance.
* We reserve the right to update, modify, or discontinue this
* software at any time. We shall have no obligation to supply such
* updates or modifications or any other form of support to you.
*
* By your use of Paradyn, you understand and agree that we (or any
* other person or entity with proprietary rights in Paradyn) are
* under no obligation to provide either maintenance services,
* update services, notices of latent defects, or correction of
* defects for Paradyn.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef DYNINST_COMMON_DYNINST_VISIBILITY_H
#define DYNINST_COMMON_DYNINST_VISIBILITY_H

#define DYNINST_EXPORT __attribute__((visibility ("default")))

#endif
4 changes: 2 additions & 2 deletions common/h/entryIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ enum prefixEntryID : unsigned int {
};

namespace NS_x86 {
COMMON_EXPORT extern dyn_hash_map<entryID, std::string> entryNames_IAPI;
COMMON_EXPORT extern dyn_hash_map<prefixEntryID, std::string> prefixEntryNames_IAPI;
DYNINST_EXPORT extern dyn_hash_map<entryID, std::string> entryNames_IAPI;
DYNINST_EXPORT extern dyn_hash_map<prefixEntryID, std::string> prefixEntryNames_IAPI;
}

#endif
2 changes: 1 addition & 1 deletion common/h/registers/MachRegister.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
namespace Dyninst {
typedef unsigned long MachRegisterVal;

class COMMON_EXPORT MachRegister {
class DYNINST_EXPORT MachRegister {
private:
int32_t reg;

Expand Down
4 changes: 2 additions & 2 deletions common/h/registers/reg_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
// const.
# define DEF_REGISTER(name, value, Arch) \
const signed int i##name = (value); \
COMMON_EXPORT MachRegister name(i##name, Arch "::" #name)
DYNINST_EXPORT MachRegister name(i##name, Arch "::" #name)
#else
# define DEF_REGISTER(name, value, Arch) \
const signed int i##name = (value); \
COMMON_EXPORT extern MachRegister name
DYNINST_EXPORT extern MachRegister name

#endif

Expand Down

0 comments on commit 67bc82c

Please sign in to comment.