[ovs-dev,1/5] compiler: Disable BUILD_MESSAGE() when processing with sparse.

Message ID 20190408182206.15688-1-blp@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev,1/5] compiler: Disable BUILD_MESSAGE() when processing with sparse.
Related show

Commit Message

Ben Pfaff April 8, 2019, 6:22 p.m.
sparse doesn't support _Pragma(message(x)), even though GCC does, so
HAVE_PRAGMA_MESSAGE is deceptive in that case and causes pointless errors.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/compiler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ben Pfaff April 8, 2019, 7:47 p.m. | #1
On Mon, Apr 08, 2019 at 11:22:02AM -0700, Ben Pfaff wrote:
> sparse doesn't support _Pragma(message(x)), even though GCC does, so
> HAVE_PRAGMA_MESSAGE is deceptive in that case and causes pointless errors.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Alin separately reviewed this one, and I've applied it, so you can
ignore it now.

The rest of the series still needs reviewing.

Patch

diff --git a/lib/compiler.h b/lib/compiler.h
index 9e44d46d7137..03af47a03563 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -1,5 +1,5 @@ 
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2019 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ 
 
 /* Output a message (not an error) while compiling without failing the
  * compilation process */
-#if HAVE_PRAGMA_MESSAGE
+#if HAVE_PRAGMA_MESSAGE && !__CHECKER__
 #define DO_PRAGMA(x) _Pragma(#x)
 #define BUILD_MESSAGE(x) \
     DO_PRAGMA(message(x))