From eaf9affa5ec9c5fd919e4207ab80b4677650ac67 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 18 Mar 2014 17:25:07 -0600 Subject: [PATCH] c11/threads: don't include assert.h if the assert macro is already defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In the gallium code, the assert() macro could come from either the system's assert.h file (via c11/threads.h) or from gallium's u_debug.h. It looks like all known assert.h files unconditionally #undef assert before defining their own version. So the assert you get depends on whether threads.h or u_debug.h was included last. In the gallium code we really want to use the assert() from u_debug.h (it behaves better on Windows). In gallium, c11/threads.h is only included after u_debug.h in the os_thread.h wrapper. So Adding an #ifndef assert test in the threads*.h files avoids using the system's assert(). Cc: "10.1" Reviewed-by: José Fonseca --- include/c11/threads_posix.h | 2 ++ include/c11/threads_win32.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h index 7e96715c248..f9c165df4e0 100644 --- a/include/c11/threads_posix.h +++ b/include/c11/threads_posix.h @@ -27,7 +27,9 @@ * DEALINGS IN THE SOFTWARE. */ #include +#ifndef assert #include +#endif #include #include #include diff --git a/include/c11/threads_win32.h b/include/c11/threads_win32.h index d4c2a72d277..5298a84321d 100644 --- a/include/c11/threads_win32.h +++ b/include/c11/threads_win32.h @@ -26,7 +26,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#ifndef assert #include +#endif #include #include #include // MSVCRT -- 2.30.2