Module: xenomai-3
Branch: master
Commit: dfec891315969f92aec781d037dd5cbb11cbdb1c
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dfec891315969f92aec781d037dd5cbb11cbdb1c

Author: Ronny Meeus <ronny.me...@gmail.com>
Date:   Tue Nov 29 15:03:00 2016 +0100

include/psos: remove dependency on tunables.h

The psos.h file pollutes the application's namespace with defines
of the boilerplate code because the tunables.h is included. In our
application we already have a definition of the list_entry macro,
resulting in a redefinition. The psos.h should be kept clean.

Following small test program clearly shows the issue:

int main(int argc, char * const argv[])
{
  return 0;
}

When compiling the code above a warning is generated:

simple_test.c:3:1: warning: "list_entry" redefined
In file included from boilerplate/list.h:24,
                 from boilerplate/setup.h:21,
                 from boilerplate/tunables.h:22,
                 from psos/psos.h:28,
                 from simple_test.c:1:
boilerplate/shared-list.h:233:1: warning: this is the location of the previous 
definition

This patch resolves the issue by moving the tunable related functionality in
a seperate header file.

---

 include/psos/Makefile.am |    4 +++-
 include/psos/psos.h      |   13 ------------
 include/psos/tunables.h  |   49 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/include/psos/Makefile.am b/include/psos/Makefile.am
index 0174271..ee7c5c8 100644
--- a/include/psos/Makefile.am
+++ b/include/psos/Makefile.am
@@ -1,3 +1,5 @@
 includesubdir = $(includedir)/psos
 
-includesub_HEADERS = psos.h
+includesub_HEADERS = \
+               psos.h \
+               tunables.h
diff --git a/include/psos/psos.h b/include/psos/psos.h
index a6f1559..1554244 100644
--- a/include/psos/psos.h
+++ b/include/psos/psos.h
@@ -25,7 +25,6 @@
 #define _XENOMAI_PSOS_PSOS_H
 
 #include <sys/types.h>
-#include <boilerplate/tunables.h>
 
 #ifndef SUCCESS
 #define SUCCESS 0
@@ -370,18 +369,6 @@ int psos_task_normalize_priority(u_long psos_prio);
 
 u_long psos_task_denormalize_priority(int core_prio);
 
-extern int psos_long_names;
-
-static inline define_config_tunable(long_names, int, on)
-{
-       psos_long_names = on;
-}
-
-static inline read_config_tunable(long_names, int)
-{
-       return psos_long_names;
-}
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/include/psos/tunables.h b/include/psos/tunables.h
new file mode 100644
index 0000000..2dbd3f0
--- /dev/null
+++ b/include/psos/tunables.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2001-2010 Philippe Gerum <r...@xenomai.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ *
+ * This file satisfies the references within the emulator code
+ * mimicking a pSOS-like API built upon the copperplate library.
+ *
+ * pSOS and pSOS+ are registered trademarks of Wind River Systems, Inc.
+ */
+
+#ifndef _XENOMAI_PSOS_TUNABLES_H
+#define _XENOMAI_PSOS_TUNABLES_H
+
+#include <boilerplate/tunables.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern int psos_long_names;
+
+static inline define_config_tunable(long_names, int, on)
+{
+       psos_long_names = on;
+}
+
+static inline read_config_tunable(long_names, int)
+{
+       return psos_long_names;
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !_XENOMAI_PSOS_TUNABLES_H */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to