From 08709d4117696a0efafa3946262bac9643c66607 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Wed, 15 Jan 2020 13:27:02 -0600 Subject: [PATCH] Removed sorting on LDFLAGS in common.mk (#373). Details: - Removed a line of code in common.mk that passed LDFLAGS through the sort function. The purpose was not to sort the contents, but rather to remove duplicates. However, there is valid syntax in a string of linker flags that, when sorted, yields different/broken behavior. So I've removed the line in common.mk that sorts LDFLAGS. Also, for future use, I've added a new function, rm-dupls, that removes duplicates without sorting. (This function was based on code from a stackoverflow thread that is linked to in the comments for that code.) Thanks to Isuru Fernando for reporting this issue (#373). Change-Id: Ie355cc111fd2c6669f0c3088e8fa5dc7c407a3b9 --- CREDITS | 1 + common.mk | 8 +++++--- frame/base/bli_mem.h | 2 +- frame/thread/bli_thread.c | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CREDITS b/CREDITS index ecc017fee..8350e2a89 100644 --- a/CREDITS +++ b/CREDITS @@ -55,6 +55,7 @@ but many others have contributed code and feedback, including Devin Matthews @devinamatthews (The University of Texas at Austin) Stefanos Mavros @smavros Nisanth Padinharepatt (AMD) + Ajay Panyala @ajaypanyala Devangi Parikh @dnparikh (The University of Texas at Austin) Elmar Peise @elmar-peise (RWTH-Aachen) Clément Pernet @ClementPernet diff --git a/common.mk b/common.mk index cc53eaad2..d02336550 100644 --- a/common.mk +++ b/common.mk @@ -212,6 +212,11 @@ get-sandbox-cxxtext-for = "('$(1)' CXXFLAGS for sandboxes)" files-that-contain = $(strip $(foreach f, $(1), $(if $(findstring $(2),$(f)),$(f),))) files-that-dont-contain = $(strip $(foreach f, $(1), $(if $(findstring $(2),$(f)),,$(f)))) +# Define a function that removes duplicate words from a list. +# NOTE: This function was obtained via [1]; thanks bobbogo for this +# concise definition. +# [1] https://stackoverflow.com/questions/16144115/makefile-remove-duplicate-words-without-sorting +rm-dupls = $(if $1,$(firstword $1) $(call rm-dupls,$(filter-out $(firstword $1),$1))) # @@ -833,9 +838,6 @@ endif # --- LDFLAGS cleanup ---------------------------------------------------------- # -# Remove duplicate flags/options in LDFLAGS (such as -lpthread) by sorting. -LDFLAGS := $(sort $(LDFLAGS)) - # diff --git a/frame/base/bli_mem.h b/frame/base/bli_mem.h index e6879393d..d7805ba99 100644 --- a/frame/base/bli_mem.h +++ b/frame/base/bli_mem.h @@ -153,7 +153,7 @@ static void bli_mem_clear( mem_t* mem ) //Pass actual type instead bli_mem_set_buf_type ( pb, mem ); #else - bli_mem_set_buf_type( -1, mem ); + bli_mem_set_buf_type( ( packbuf_t )-1, mem ); #endif bli_mem_set_pool( NULL, mem ); bli_mem_set_size( 0, mem ); diff --git a/frame/thread/bli_thread.c b/frame/thread/bli_thread.c index b9e493473..687e56afc 100644 --- a/frame/thread/bli_thread.c +++ b/frame/thread/bli_thread.c @@ -1062,7 +1062,6 @@ void bli_thread_partition_2x2 { *nt1 = ( work1 >= work2 ? n_thread : 1 ); *nt2 = ( work1 < work2 ? n_thread : 1 ); - return; }