Boost logo

Boost :

Subject: [boost] FW: [uuid] changes to fix warnings from the linker
From: christian.leutloff_at_[hidden]
Date: 2009-07-22 12:54:32


Hi,

thank you for the boost.uuid lib!

Could you please add some more "inline"s to some of the methods to avoid
warnings from the VS2008 compiler?

I'm using the uuid implementation from uuid_alt_v13_pod.zip downloaded from
http://www.boostpro.com/vault/index.php.

This is one of the warnings:

warning LNK4006: "bool __cdecl boost::uuids::operator<(class boost::uuids::uuid
const &,class boost::uuids::uuid const &)" (??Muuids_at_boost@@YA_NABVuuid_at_01@0_at_Z)
already defined in xxx.obj; second definition

Here is the patch to fix the warnings:

Index: boost/uuid/uuid.hpp
===================================================================
--- boost/uuid/uuid.hpp (revision 65)
+++ boost/uuid/uuid.hpp (working copy)
@@ -152,28 +152,28 @@
     x.swap(y);
 }
 
-bool operator==(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator==(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return (lhs.data_ == rhs.data_);
 }
-bool operator!=(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator!=(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return !(lhs == rhs);
 }
 
-bool operator<(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator<(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return (lhs.data_ < rhs.data_);
 }
-bool operator>(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator>(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return rhs < lhs;
 }
-bool operator<=(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator<=(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return !(lhs > rhs);
 }
-bool operator>=(uuid const& lhs, uuid const& rhs) /* throw() */
+inline bool operator>=(uuid const& lhs, uuid const& rhs) /* throw() */
 {
     return !(lhs < rhs);
 }
@@ -191,7 +191,7 @@
 }
 
 // As named in RFC 4122, 4.1.7
-uuid nil() {
+inline uuid nil() {
     uuid u = uuid();
     return u;
 }
Index: boost/uuid/uuid_io.hpp
===================================================================
--- boost/uuid/uuid_io.hpp (revision 65)
+++ boost/uuid/uuid_io.hpp (working copy)
@@ -22,7 +22,7 @@
 
 namespace detail {
 
-int get_showbraces_index()
+static int get_showbraces_index()
 {
     static int index = std::ios_base::xalloc();
     return index;
Index: boost/uuid/uuid_namespaces.hpp
===================================================================
--- boost/uuid/uuid_namespaces.hpp (revision 65)
+++ boost/uuid/uuid_namespaces.hpp (working copy)
@@ -42,7 +42,7 @@
 namespace namespaces {
 
 /* Name string is a fully-qualified domain name */
-uuid dns() {
+inline uuid dns() {
     uuid u = { /* 6ba7b810-9dad-11d1-80b4-00c04fd430c8 */
        0x6b, 0xa7, 0xb8, 0x10,
        0x9d, 0xad,
@@ -53,7 +53,7 @@
 }
 
 /* Name string is a URL */
-uuid url() {
+inline uuid url() {
     uuid u = { /* 6ba7b811-9dad-11d1-80b4-00c04fd430c8 */
        0x6b, 0xa7, 0xb8, 0x11,
        0x9d, 0xad,
@@ -64,7 +64,7 @@
 }
 
 /* Name string is an ISO OID */
-uuid oid() {
+inline uuid oid() {
     uuid u = { /* 6ba7b812-9dad-11d1-80b4-00c04fd430c8 */
        0x6b, 0xa7, 0xb8, 0x12,
        0x9d, 0xad,
@@ -75,7 +75,7 @@
 }
 
 /* Name string is an X.500 DN (in DER or a text output format) */
-uuid x500() {
+inline uuid x500() {
     uuid u = { /* 6ba7b814-9dad-11d1-80b4-00c04fd430c8 */
        0x6b, 0xa7, 0xb8, 0x14,
        0x9d, 0xad,

Bye
Christian
-- 
Christian Leutloff, Aachen, Germany
______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk