Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / soreduce / Obj_Module.h
blob4c8e01990313506541baf28f13a2986f5833213c
1 // -*- C++ -*-
2 // File: Obj_Module.h
4 // Author: Phil Mesnier
6 #ifndef _OBJ_MODULE_H_
7 #define _OBJ_MODULE_H_
9 // Obj_Module encapsulates the result of applying nm to a single object module
10 // in a shared library. Currently an object module consists of two types of
11 // signatures, those that are exported, able to resolve references from others,
12 // and those that are imported, needing resolution.
14 // Obj_Modules keep track of external references. In the end, any module that
15 // has one or more external references to it must be included in the resulting
16 // library. While the means exists to remove external references, perhaps
17 // through further analysis of undefined signatures and their usage, this is
18 // not currently done. Once a technique is discovered to allow for easy
19 // determination that reference is truly unneeded this code may be useful.
21 #include "Sig_List.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 class ACE_Message_Block;
25 ACE_END_VERSIONED_NAMESPACE_DECL
27 class Obj_Module {
28 public:
29 Obj_Module ( const ACE_CString &, int = 500);
31 // Returns the list of exported signatures, ie. those that are defined in
32 // this module
33 Sig_List & exports();
35 // Returns the list of signatures used by this module but not defined within
36 Sig_List & imports();
38 // Returns the name of the object module.
39 ACE_CString &name();
41 // Add_source invokes GNU nm on the supplied file and parses the output to
42 // build the list of imported and exported signatures. When replacing GNU
43 // nm to use a different tool, this method must be modified. In the future
44 // this could be a virtual to allow for specialization based on toolset.
45 void add_source (const char *, int = 0);
47 // Get the number of external references to this object module. At the end
48 // of processing, if the number of external references is 0, the module is
49 // not included in the final library.
50 int extref ();
52 // add a new external reference to this module.
53 void add_extref ();
55 // remove an exterenal reference. Currently, this function is not used.
56 void remove_extref();
58 private:
59 void populate_sig_list (Sig_List &, int , ACE_Message_Block *);
60 int read_line (ACE_HANDLE src, ACE_Message_Block **buf);
62 ACE_CString name_;
63 Sig_List imports_;
64 Sig_List exports_;
65 int extrefs_;
68 #endif /* _OBJ_MODULE_H_ */