From c90960fc8824a42356e3c822f6df64cc8ec64b34 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 13 Feb 2017 18:11:40 -0500 Subject: [PATCH] Fix LDFLAGS and CFLAGS not preserving order, bug1130. --- Changes | 2 ++ src/V3EmitMk.cpp | 8 ++++---- src/V3Options.cpp | 8 ++------ src/V3Options.h | 10 +++++----- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Changes b/Changes index 73634096c..e88cee698 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix 2009 localparam syntax, msg2139. [Galen Seitz] +**** Fix LDFLAGS and CFLAGS not preserving order, bug1130. [Olof Kindgren] + * Verilator 3.900 2017-01-15 diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index 7824cc687..01cf1d87b 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -168,16 +168,16 @@ public: of.puts("# User CFLAGS (from -CFLAGS on Verilator command line)\n"); of.puts("VM_USER_CFLAGS = \\\n"); - const V3StringSet& cFlags = v3Global.opt.cFlags(); - for (V3StringSet::const_iterator it = cFlags.begin(); it != cFlags.end(); ++it) { + const V3StringList& cFlags = v3Global.opt.cFlags(); + for (V3StringList::const_iterator it = cFlags.begin(); it != cFlags.end(); ++it) { of.puts("\t"+*it+" \\\n"); } of.puts("\n"); of.puts("# User LDLIBS (from -LDFLAGS on Verilator command line)\n"); of.puts("VM_USER_LDLIBS = \\\n"); - const V3StringSet& ldLibs = v3Global.opt.ldLibs(); - for (V3StringSet::const_iterator it = ldLibs.begin(); it != ldLibs.end(); ++it) { + const V3StringList& ldLibs = v3Global.opt.ldLibs(); + for (V3StringList::const_iterator it = ldLibs.begin(); it != ldLibs.end(); ++it) { of.puts("\t"+*it+" \\\n"); } of.puts("\n"); diff --git a/src/V3Options.cpp b/src/V3Options.cpp index df8a4e48a..68d0b732f 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -183,14 +183,10 @@ void V3Options::addCppFile(const string& filename) { } } void V3Options::addCFlags(const string& filename) { - if (m_cFlags.find(filename) == m_cFlags.end()) { - m_cFlags.insert(filename); - } + m_cFlags.push_back(filename); } void V3Options::addLdLibs(const string& filename) { - if (m_ldLibs.find(filename) == m_ldLibs.end()) { - m_ldLibs.insert(filename); - } + m_ldLibs.push_back(filename); } void V3Options::addFuture(const string& flag) { if (m_futures.find(flag) == m_futures.end()) { diff --git a/src/V3Options.h b/src/V3Options.h index 2b829427e..8b9c96e95 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -48,9 +48,9 @@ class V3Options { // MEMBERS (general options) V3OptionsImp* m_impp; // Slow hidden options - V3StringSet m_cppFiles; // argument: C++ files to link against - V3StringSet m_cFlags; // argument: user CFLAGS - V3StringSet m_ldLibs; // argument: user LDFLAGS + V3StringSet m_cppFiles; // argument: C++ files to link against + V3StringList m_cFlags; // argument: user CFLAGS + V3StringList m_ldLibs; // argument: user LDFLAGS V3StringSet m_futures; // argument: -Wfuture- list V3StringSet m_libraryFiles; // argument: Verilog -v files V3StringSet m_clockers; // argument: Verilog -clk signals @@ -281,8 +281,8 @@ class V3Options { string xAssign() const { return m_xAssign; } const V3StringSet& cppFiles() const { return m_cppFiles; } - const V3StringSet& cFlags() const { return m_cFlags; } - const V3StringSet& ldLibs() const { return m_ldLibs; } + const V3StringList& cFlags() const { return m_cFlags; } + const V3StringList& ldLibs() const { return m_ldLibs; } const V3StringSet& libraryFiles() const { return m_libraryFiles; } const V3StringList& vFiles() const { return m_vFiles; } const V3StringList& forceIncs() const { return m_forceIncs; }