[ovs-dev] BUILD_MESSAGE on GCC

Daniele Di Proietto ddiproietto at vmware.com
Tue Sep 16 22:30:00 UTC 2014


Hi Ben,

I tested it on GCC 4.9.1 (debian testing) and GCC 4.8.2 (ubuntu 14.04.1)
and it works.
I think the errors you are experiencing come from sparse.

My guess is that sparse does not support _Pragma(message()), but since GCC
supports it, HAVE_PRAGMA_MESSAGE is 1.

I think the best solution would be to disable BUILD_MESSAGE if __CHECKER__
is defined.

Does this make sense? Do you agree with the solution? I can post a patch
if you want.

Sorry about this, I should have checked with sparse before posting
BUILD_MESSAGE

Daniele


On 9/16/14, 2:53 PM, "Ben Pfaff" <blp at nicira.com> wrote:

>For me, BUILD_MESSAGE works as expected with Clang but not GCC.  With
>Clang:
>
>    ../lib/flow.c:126:1: warning: FLOW_WC_SEQ changed: miniflow_extract()
>will have
>          runtime assertions enabled. Consider updating FLOW_WC_SEQ after
>testing
>          [-W#pragma-messages]
>    BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have
>runtime "
>    ^
>    ../lib/compiler.h:229:5: note: expanded from macro 'BUILD_MESSAGE'
>        DO_PRAGMA(message(x))
>        ^
>    ../lib/compiler.h:227:22: note: expanded from macro 'DO_PRAGMA'
>    #define DO_PRAGMA(x) _Pragma(#x)
>                         ^
>    <scratch space>:8:2: note: expanded from here
>     message("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
>"a...
>     ^
>
>but with GCC:
>
>    ../lib/flow.c:126:1: error: Expected ) in function declarator
>    ../lib/flow.c:126:1: error: got "message(\"FLOW_WC_SEQ changed:
>miniflow_extract() will have runtime \" \"assertions enabled. Consider
>updating FLOW_WC_SEQ after \" \"testing\")"
>    ../lib/flow.c:210:12: error: Expected ) in function declarator
>    ../lib/flow.c:210:12: error: got (
>    ../lib/flow.c:210:5: error: Trying to use reserved word 'while' as
>identifier
>    ../lib/flow.c:212:15: error: Expected ) in function declarator
>    ../lib/flow.c:212:15: error: got ->
>    ../lib/flow.c:212:9: error: Trying to use reserved word 'if' as
>identifier
>    ../lib/flow.c:214:9: error: Expected ; at the end of type declaration
>    ../lib/flow.c:214:9: error: got }
>    [and on and on...]
>
>Do you know how to make it work with GCC?  A few experiments didn't work
>for me.
>_______________________________________________
>dev mailing list
>dev at openvswitch.org
>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/
>listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2BU
>6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=410hUrrnGkunRbImdPM7UeBXUueBpCV3yQ0eDHZkE
>XY%3D%0A&s=d32b3f6735a8ab1aac8480b4ea6734de317b33d9316745cf4a50139330cc1e7
>8




More information about the dev mailing list