From 477ce91c5281df2bbfaddc4d86312fb8c8f879e2 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Wed, 22 Apr 2020 14:26:49 -0500 Subject: [PATCH] Moved #include "cpuid.h" to bli_cpuid.c. Details: - Relocated the #include "cpuid.h" directive from bli_cpuid.h to bli_cpuid.c. This was done because cpuid.h (which is pulled into the post-build blis.h developer header) doesn't protect its definitions with a preprocessor guard of the form: #ifndef FOOBAR_H #define FOOBAR_H // header contents. #endif and as a result, applications (previously) could not #include both blis.h and cpuid.h (since the former was already including the latter). Thanks to Bhaskar Nallani for raising this issue via #393 and to Devin Matthews for suggesting this fix. - CREDITS file update. --- CREDITS | 1 + frame/base/bli_cpuid.c | 8 +++++--- frame/base/bli_cpuid.h | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CREDITS b/CREDITS index 0693d6639..d86c093d9 100644 --- a/CREDITS +++ b/CREDITS @@ -56,6 +56,7 @@ but many others have contributed code and feedback, including Simon Lukas Märtens @ACSimon33 (RWTH Aachen University) Devin Matthews @devinamatthews (The University of Texas at Austin) Stefanos Mavros @smavros + Bhaskar Nallani @BhaskarNallani (AMD) Nisanth Padinharepatt (AMD) Ajay Panyala @ajaypanyala Devangi Parikh @dnparikh (The University of Texas at Austin) diff --git a/frame/base/bli_cpuid.c b/frame/base/bli_cpuid.c index 8ea80cb14..39a603248 100644 --- a/frame/base/bli_cpuid.c +++ b/frame/base/bli_cpuid.c @@ -46,20 +46,22 @@ #define __arm__ #endif -#ifndef BLIS_CONFIGURETIME_CPUID - #include "blis.h" -#else +#ifdef BLIS_CONFIGURETIME_CPUID #define BLIS_EXPORT_BLIS #include "bli_system.h" #include "bli_type_defs.h" #include "bli_cpuid.h" #include "bli_arch.h" +#else + #include "blis.h" #endif // ----------------------------------------------------------------------------- #if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) +#include "cpuid.h" + arch_t bli_cpuid_query_id( void ) { uint32_t vendor, family, model, features; diff --git a/frame/base/bli_cpuid.h b/frame/base/bli_cpuid.h index b7ba96ef9..06af3d3dc 100644 --- a/frame/base/bli_cpuid.h +++ b/frame/base/bli_cpuid.h @@ -125,7 +125,9 @@ static bool_t bli_cpuid_has_features( uint32_t have, uint32_t want ) #if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) -#include "cpuid.h" +// cpuid.h is now #included in bli_cpuid.c instead of here. See issue #393 +// for more information why this move was made. +//#include "cpuid.h" void get_cpu_name( char *cpu_name ); int vpu_count( void );