[PATCH] D58427: Fix checking for rpc/xdr.h

Enji Cooper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 21:18:48 PST 2019


ngie created this revision.
ngie added reviewers: EricWF, MaskRay.
Herald added subscribers: llvm-commits, Sanitizers, jdoerfert, fedor.sergeev, krytarowski, mgorny, kubamracek, emaste.
Herald added projects: Sanitizers, LLVM.

`rpc/xdr.h` (on FreeBSD) at least requires `rpc/types.h`. Check for both
headers (and include both headers) whenever including `rpc/xdr.h` to
ensure that the code will compile on supported platforms.

While this won't affect FreeBSD, this may affect non-standard Linux-based
or Solaris-based platforms, based on FreeBSD's variant of libc (ex:
android's bionic library).

Signed-off-by: Enji Cooper <yaneurabeya at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58427

Files:
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
  compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
  compiler-rt/test/msan/Linux/sunrpc.cc
  compiler-rt/test/msan/Linux/sunrpc_bytes.cc
  compiler-rt/test/msan/Linux/sunrpc_string.cc


Index: compiler-rt/test/msan/Linux/sunrpc_string.cc
===================================================================
--- compiler-rt/test/msan/Linux/sunrpc_string.cc
+++ compiler-rt/test/msan/Linux/sunrpc_string.cc
@@ -7,6 +7,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <rpc/types.h>
 #include <rpc/xdr.h>
 
 #include <sanitizer/msan_interface.h>
Index: compiler-rt/test/msan/Linux/sunrpc_bytes.cc
===================================================================
--- compiler-rt/test/msan/Linux/sunrpc_bytes.cc
+++ compiler-rt/test/msan/Linux/sunrpc_bytes.cc
@@ -7,6 +7,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <rpc/types.h>
 #include <rpc/xdr.h>
 
 #include <sanitizer/msan_interface.h>
Index: compiler-rt/test/msan/Linux/sunrpc.cc
===================================================================
--- compiler-rt/test/msan/Linux/sunrpc.cc
+++ compiler-rt/test/msan/Linux/sunrpc.cc
@@ -14,6 +14,7 @@
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
 #include <assert.h>
+#include <rpc/types.h>
 #include <rpc/xdr.h>
 
 #include <sanitizer/msan_interface.h>
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
@@ -28,6 +28,7 @@
 #include <poll.h>
 #include <pthread.h>
 #include <pwd.h>
+#include <rpc/types.h>
 #include <rpc/xdr.h>
 #include <semaphore.h>
 #include <signal.h>
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -114,6 +114,7 @@
 #include <netipx/ipx.h>
 #include <netrom/netrom.h>
 #if HAVE_RPC_XDR_H
+# include <rpc/types.h>
 # include <rpc/xdr.h>
 #endif
 #include <scsi/scsi.h>
Index: compiler-rt/cmake/base-config-ix.cmake
===================================================================
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -4,12 +4,13 @@
 # runtime libraries.
 
 include(CheckIncludeFile)
+include(CheckIncludeFiles)
 include(CheckCXXSourceCompiles)
 
 check_include_file(unwind.h HAVE_UNWIND_H)
 
 # Used by sanitizer_common and tests.
-check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
+check_include_files("rpc/types.h;rpc/xdr.h" HAVE_RPC_XDR_H)
 if (NOT HAVE_RPC_XDR_H)
   set(HAVE_RPC_XDR_H 0)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58427.187515.patch
Type: text/x-patch
Size: 2601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190220/212afce6/attachment-0001.bin>


More information about the llvm-commits mailing list