[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-2309-g6f2d033

Rolf Eike Beer eike at sf-mail.de
Mon Apr 14 12:23:36 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  6f2d03319e4281fac3665d97ee17817733ef64a1 (commit)
       via  63a9103db3a0055314fa1c6537733123fbd54619 (commit)
      from  bb18e73f1ab4b64eeb0c0ef177f0e27c084b16c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f2d03319e4281fac3665d97ee17817733ef64a1
commit 6f2d03319e4281fac3665d97ee17817733ef64a1
Merge: bb18e73 63a9103
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Mon Apr 14 12:23:35 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Apr 14 12:23:35 2014 -0400

    Merge topic 'openbsd-sign-warning' into next
    
    63a9103d cmELF: fix signedness warning on OpenBSD


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63a9103db3a0055314fa1c6537733123fbd54619
commit 63a9103db3a0055314fa1c6537733123fbd54619
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Mon Apr 14 18:13:19 2014 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Mon Apr 14 18:21:21 2014 +0200

    cmELF: fix signedness warning on OpenBSD
    
    OpenBSD defines Elf64_Dyn::d_tag to be of an unsigned type, which differs from
    what most other platforms do and what is the case for 32 bit. To have the tag
    as unsigned makes sense, but this causes a compilation warning:
    
    /.../CMake/Source/cmELF.cxx: In member function 'const cmELF::StringEntry* cmELFInternalImpl<Types>::GetDynamicSectionString(int) [with Types = cmELFTypes64]':
    /.../CMake/Source/cmELF.cxx:945:   instantiated from here
    /.../CMake/Source/cmELF.cxx:668: warning: comparison between signed and unsigned integer expressions
    
    Add an explicit typedef to cast the value to for 32 and 64 bit. That type is
    unsigned and has the proper length for both platforms so no information is
    lost. Explicitely cast both arguments before comparing them to avoid the
    warning in all situations.

diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index dc6772c..7abf557 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -124,7 +124,7 @@ public:
   virtual unsigned int GetNumberOfSections() const = 0;
   virtual unsigned int GetDynamicEntryCount() = 0;
   virtual unsigned long GetDynamicEntryPosition(int j) = 0;
-  virtual StringEntry const* GetDynamicSectionString(int tag) = 0;
+  virtual StringEntry const* GetDynamicSectionString(unsigned int tag) = 0;
   virtual void PrintInfo(std::ostream& os) const = 0;
 
   bool ReadBytes(unsigned long pos, unsigned long size, char* buf)
@@ -187,7 +187,7 @@ protected:
     }
 
   // Store string table entry states.
-  std::map<int, StringEntry> DynamicSectionStrings;
+  std::map<unsigned int, StringEntry> DynamicSectionStrings;
 };
 
 //----------------------------------------------------------------------------
@@ -198,6 +198,7 @@ struct cmELFTypes32
   typedef Elf32_Shdr ELF_Shdr;
   typedef Elf32_Dyn  ELF_Dyn;
   typedef Elf32_Half ELF_Half;
+  typedef unsigned int tagtype;
   static const char* GetName() { return "32-bit"; }
 };
 
@@ -208,6 +209,7 @@ struct cmELFTypes64
   typedef Elf64_Shdr ELF_Shdr;
   typedef Elf64_Dyn  ELF_Dyn;
   typedef Elf64_Half ELF_Half;
+  typedef unsigned long long tagtype;
   static const char* GetName() { return "64-bit"; }
 };
 
@@ -222,6 +224,7 @@ public:
   typedef typename Types::ELF_Shdr ELF_Shdr;
   typedef typename Types::ELF_Dyn  ELF_Dyn;
   typedef typename Types::ELF_Half ELF_Half;
+  typedef typename Types::tagtype tagtype;
 
   // Construct with a stream and byte swap indicator.
   cmELFInternalImpl(cmELF* external,
@@ -239,7 +242,7 @@ public:
   virtual unsigned long GetDynamicEntryPosition(int j);
 
   // Lookup a string from the dynamic section with the given tag.
-  virtual StringEntry const* GetDynamicSectionString(int tag);
+  virtual StringEntry const* GetDynamicSectionString(unsigned int tag);
 
   // Print information about the ELF file.
   virtual void PrintInfo(std::ostream& os) const
@@ -624,10 +627,10 @@ unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j)
 //----------------------------------------------------------------------------
 template <class Types>
 cmELF::StringEntry const*
-cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
+cmELFInternalImpl<Types>::GetDynamicSectionString(unsigned int tag)
 {
   // Short-circuit if already checked.
-  std::map<int, StringEntry>::iterator dssi =
+  std::map<unsigned int, StringEntry>::iterator dssi =
     this->DynamicSectionStrings.find(tag);
   if(dssi != this->DynamicSectionStrings.end())
     {
@@ -665,7 +668,7 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
       di != this->DynamicSectionEntries.end(); ++di)
     {
     ELF_Dyn& dyn = *di;
-    if(dyn.d_tag == tag)
+    if(static_cast<tagtype>(dyn.d_tag) == static_cast<tagtype>(tag))
       {
       // We found the tag requested.
       // Make sure the position given is within the string section.

-----------------------------------------------------------------------

Summary of changes:
 Source/cmELF.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list