You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bud Bundy (JIRA)" <ji...@apache.org> on 2012/11/07 17:03:12 UTC

[jira] [Created] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Bud Bundy created THRIFT-1748:
---------------------------------

             Summary: Guard and RWGuard macros defined in global namespace
                 Key: THRIFT-1748
                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
    Affects Versions: 0.9
         Environment: Visual Studio 2010
            Reporter: Bud Bundy
            Priority: Trivial


thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.

Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier reassigned THRIFT-1748:
-----------------------------------

    Assignee: Roger Meier
    
> Guard and RWGuard macros defined in global namespace
> ----------------------------------------------------
>
>                 Key: THRIFT-1748
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Visual Studio 2010
>            Reporter: Bud Bundy
>            Assignee: Roger Meier
>            Priority: Trivial
>              Labels: newbie, patch
>
> thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.
> Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Posted by "Bud Bundy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bud Bundy updated THRIFT-1748:
------------------------------

    Labels: newbie patch  (was: )
    
> Guard and RWGuard macros defined in global namespace
> ----------------------------------------------------
>
>                 Key: THRIFT-1748
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Visual Studio 2010
>            Reporter: Bud Bundy
>            Priority: Trivial
>              Labels: newbie, patch
>
> thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.
> Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier resolved THRIFT-1748.
---------------------------------

    Resolution: Fixed

global macros removed
                
> Guard and RWGuard macros defined in global namespace
> ----------------------------------------------------
>
>                 Key: THRIFT-1748
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Visual Studio 2010
>            Reporter: Bud Bundy
>            Priority: Trivial
>              Labels: newbie, patch
>
> thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.
> Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Posted by "Bud Bundy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492455#comment-13492455 ] 

Bud Bundy commented on THRIFT-1748:
-----------------------------------

{code}
Index: Mutex.h
===================================================================
--- Mutex.h	(revision 1406661)
+++ Mutex.h	(working copy)
@@ -183,15 +183,6 @@
     const ReadWriteMutex& rw_mutex_;
 };
 
-
-// A little hack to prevent someone from trying to do "Guard(m);"
-// Such a use is invalid because the temporary Guard object is
-// destroyed at the end of the line, releasing the lock.
-// Sorry for polluting the global namespace, but I think it's worth it.
-#define Guard(m) incorrect_use_of_Guard(m)
-#define RWGuard(m) incorrect_use_of_RWGuard(m)
-
-
 }}} // apache::thrift::concurrency
 
 #endif // #ifndef _THRIFT_CONCURRENCY_MUTEX_H_
{code}
                
> Guard and RWGuard macros defined in global namespace
> ----------------------------------------------------
>
>                 Key: THRIFT-1748
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Visual Studio 2010
>            Reporter: Bud Bundy
>            Priority: Trivial
>              Labels: newbie, patch
>
> thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.
> Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1748) Guard and RWGuard macros defined in global namespace

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496568#comment-13496568 ] 

Hudson commented on THRIFT-1748:
--------------------------------

Integrated in Thrift #581 (See [https://builds.apache.org/job/Thrift/581/])
    THRIFT-1748 Guard and RWGuard macros defined in global namespace 
Patch: Bud Bundy (Revision 1406793)

     Result = SUCCESS
roger : http://svn.apache.org/viewvc/?view=rev&rev=1406793
Files : 
* /thrift/trunk/lib/cpp/src/thrift/concurrency/Mutex.h

                
> Guard and RWGuard macros defined in global namespace
> ----------------------------------------------------
>
>                 Key: THRIFT-1748
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1748
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Visual Studio 2010
>            Reporter: Bud Bundy
>            Assignee: Roger Meier
>            Priority: Trivial
>              Labels: newbie, patch
>             Fix For: 1.0
>
>
> thrift/concurrency/Mutex.h defines global macros Guard and RWGuard.  Although the purpose is well commented and appreciated - i.e. trying to prevent coders from creating temporary variables and falsely assuming they have a lock - this code does interfere with other packages that define their own Guard classes.  Even when the user/library define Guard in their own namespace, there's a clash.
> Please remove the macros.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira