From 568d0cafb8423f34530c94963654abea4c62801b Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Fri, 14 Jan 2011 23:18:07 -0500
Subject: A fix for volk_cpu being a duplicate variable. Declared as extern in
 the header file volk_cpu.h and actually created in the C files.

Note that this could be a problem if multiple architectures are ever (can ever?) be built at the same time. If that happens, we can move this variable declaration to another C file that is made common to all builds.
---
 volk/include/volk/make_cpuid_generic_c.py | 26 ++++++++++++++++++++++++--
 volk/include/volk/make_cpuid_h.py         | 25 ++++++++++++++++++++++++-
 volk/include/volk/make_cpuid_powerpc_c.py | 26 ++++++++++++++++++++++++--
 volk/include/volk/make_cpuid_x86_c.py     | 27 +++++++++++++++++++++++++--
 4 files changed, 97 insertions(+), 7 deletions(-)

(limited to 'volk/include')

diff --git a/volk/include/volk/make_cpuid_generic_c.py b/volk/include/volk/make_cpuid_generic_c.py
index 3ba225fca0..c682d4138d 100644
--- a/volk/include/volk/make_cpuid_generic_c.py
+++ b/volk/include/volk/make_cpuid_generic_c.py
@@ -1,11 +1,33 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
 from xml.dom import minidom
 
 def make_cpuid_generic_c(dom) :
     tempstring = "";
     tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
     tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
-    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n"
-    tempstring = tempstring + "\n\n"
+    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
+    tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
     
     for domarch in dom:
         if str(domarch.attributes["type"].value) == "all":
diff --git a/volk/include/volk/make_cpuid_h.py b/volk/include/volk/make_cpuid_h.py
index 823e3b2c05..cd3da24558 100644
--- a/volk/include/volk/make_cpuid_h.py
+++ b/volk/include/volk/make_cpuid_h.py
@@ -1,3 +1,25 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
 from xml.dom import minidom
 from emit_omnilog import *
 
@@ -13,7 +35,8 @@ def make_cpuid_h(dom) :
     for domarch in dom:
         arch = str(domarch.attributes["name"].value);
         tempstring = tempstring + "    int (*has_" + arch + ") ();\n";
-    tempstring = tempstring + "}volk_cpu;\n\n";
+    tempstring = tempstring + "};\n\n";
+    tempstring = tempstring + "extern struct VOLK_CPU volk_cpu;\n\n";
 
     tempstring = tempstring + "void volk_cpu_init ();\n"
     tempstring = tempstring + "unsigned int volk_get_lvarch ();\n"
diff --git a/volk/include/volk/make_cpuid_powerpc_c.py b/volk/include/volk/make_cpuid_powerpc_c.py
index 443a584888..0b0ea84e7a 100644
--- a/volk/include/volk/make_cpuid_powerpc_c.py
+++ b/volk/include/volk/make_cpuid_powerpc_c.py
@@ -1,11 +1,33 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
 from xml.dom import minidom
 
 def make_cpuid_powerpc_c(dom) :
     tempstring = "";
     tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
     tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
-    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n"
-    tempstring = tempstring + "\n\n"
+    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
+    tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
 
     #just assume it has them for powerpc
     for domarch in dom:
diff --git a/volk/include/volk/make_cpuid_x86_c.py b/volk/include/volk/make_cpuid_x86_c.py
index 8ebe243e58..48a406fa40 100644
--- a/volk/include/volk/make_cpuid_x86_c.py
+++ b/volk/include/volk/make_cpuid_x86_c.py
@@ -1,11 +1,34 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
 from xml.dom import minidom
 
 def make_cpuid_x86_c(dom) :
     tempstring = "";
     tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
     tempstring = tempstring + "#include <volk/volk_cpu.h>\n"
-    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n"
-    tempstring = tempstring + "\n\n"
+    tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n"
+    tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n"
+
     tempstring = tempstring + "extern void cpuid_x86 (unsigned int op, unsigned int result[4]);\n\n"
     tempstring = tempstring + "static inline unsigned int cpuid_eax(unsigned int op) {\n";
     tempstring = tempstring + "    unsigned int regs[4];\n"
-- 
cgit v1.2.3