Menu

#2181 MemoryBarrier fallback macro

OTHER
closed
nobody
None
Support
duplicate
Unknown
False
2016-05-21
2014-01-28
zyx
No

Current winnt.h defines MemoryBarrier macro fallback as

# define MemoryBarrier

but I realzied in one project, which hit this fallback, that it breaks build with a gcc error, because the macro is usually called as:

MemoryBarrier();

which expands with this fallback into:

();

on which gcc stops with an error. A fix for this is very simple, just define the fallback macro as:

# define MemoryBarrier()

which will also "eat" the brackets. Propose patch is attached.

1 Attachments

Discussion

  • Keith Marshall

    Keith Marshall - 2016-05-21
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,9 +1,17 @@
     Current winnt.h defines MemoryBarrier macro fallback as
    -   # define MemoryBarrier
    +
    +    # define MemoryBarrier
    +    
     but I realzied in one project, which hit this fallback, that it breaks build with a gcc error, because the macro is usually called as:
    -   MemoryBarrier();
    +
    +    MemoryBarrier();
    +    
     which expands with this fallback into:
    -   ();
    +
    +    ();
    +
     on which gcc stops with an error. A fix for this is very simple, just define the fallback macro as:
    -   # define MemoryBarrier()
    +
    +    # define MemoryBarrier()
    +
     which will also "eat" the brackets. Propose patch is attached.
    
    • status: unread --> closed
    • Resolution: none --> duplicate
     
  • Keith Marshall

    Keith Marshall - 2016-05-21

    Yes, the definition is inappropriate, but this is a duplicate of [#2131].

     

    Related

    Issues: #2131