Fix compilation errors
1. "not a universal character"
2. pthread_getname_np/pthread_setname_np
3. rtBound/rtUnbound/FIRST_PROTOCOL_SIGNAL_ID
4. Move #pragma directives outside functions with GCC version checks
5. Updated UML to xtUMLrt translator to use AUTOMATIC_LOCKED as
PortRegistrationType, according to the new profile.
Change-Id: Ie9eb3280a250272a2cf1fe7312d0947d4e9cf388
Signed-off-by: Barry Maher <bmaher@gpinc.ca>
diff --git a/codegen/org.eclipse.papyrusrt.codegen.xtumlrt.trans/src/org/eclipse/papyrusrt/codegen/xtumlrt/trans/UML2xtumlrtModelTranslator.xtend b/codegen/org.eclipse.papyrusrt.codegen.xtumlrt.trans/src/org/eclipse/papyrusrt/codegen/xtumlrt/trans/UML2xtumlrtModelTranslator.xtend
index 3995314..702ea9d 100644
--- a/codegen/org.eclipse.papyrusrt.codegen.xtumlrt.trans/src/org/eclipse/papyrusrt/codegen/xtumlrt/trans/UML2xtumlrtModelTranslator.xtend
+++ b/codegen/org.eclipse.papyrusrt.codegen.xtumlrt.trans/src/org/eclipse/papyrusrt/codegen/xtumlrt/trans/UML2xtumlrtModelTranslator.xtend
@@ -624,7 +624,7 @@
{
case AUTOMATIC: registration = PortRegistration.AUTOMATIC
case APPLICATION: registration = PortRegistration.APPLICATION
- case APPLICATION_LOCKED: registration = PortRegistration.APPLICATIONLOCKED
+ case AUTOMATIC_LOCKED: registration = PortRegistration.APPLICATIONLOCKED
}
}
it
diff --git a/rts/base/basedebug.cc b/rts/base/basedebug.cc
index 009dcf9..c7074ca 100644
--- a/rts/base/basedebug.cc
+++ b/rts/base/basedebug.cc
@@ -27,19 +27,19 @@
namespace base
{
// Colour codes:
- static const char * ANSI_RESET = "\u001B[0m";
+ //-static const char * ANSI_RESET = "\u001B[0m";
//static const char * ANSI_DIM_BLACK = "\u001B[2;30m";
//static const char * ANSI_DIM_RED = "\u001B[2;31m";
//static const char * ANSI_DIM_GREEN = "\u001B[2;32m";
//static const char * ANSI_DIM_YELLOW = "\u001B[2;33m";
- static const char * ANSI_DIM_BLUE = "\u001B[2;34m";
+ //-static const char * ANSI_DIM_BLUE = "\u001B[2;34m";
//static const char * ANSI_DIM_PURPLE = "\u001B[2;35m";
//static const char * ANSI_DIM_CYAN = "\u001B[2;36m";
//static const char * ANSI_BRIGHT_BLACK = "\u001B[1;30m";
- static const char * ANSI_BRIGHT_RED = "\u001B[1;31m";
+ //-static const char * ANSI_BRIGHT_RED = "\u001B[1;31m";
//static const char * ANSI_BRIGHT_GREEN = "\u001B[1;32m";
//static const char * ANSI_BRIGHT_YELLOW = "\u001B[1;33m";
- static const char * ANSI_BRIGHT_BLUE = "\u001B[1;34m";
+ //-static const char * ANSI_BRIGHT_BLUE = "\u001B[1;34m";
//static const char * ANSI_BRIGHT_PURPLE = "\u001B[1;35m";
//static const char * ANSI_BRIGHT_CYAN = "\u001B[1;36m";
//static const char * ANSI_WHITE = "\u001B[37m";
@@ -174,9 +174,9 @@
}
if (debugEnableThreadId && outputprefix)
{
+#if 0
// Not universally available.
char name[80]; // TODO: remove magic #.
-#if __USE_GNU
if (pthread_getname_np(pthread_self(), name, sizeof(name)) != 0)
strcpy(name, "?");
printf("%s:", name);
@@ -452,28 +452,28 @@
{
if (debugEnableColor)
{
- printf("%s", ANSI_RESET);
+ //printf("%s", ANSI_RESET);
}
}
void debugColourBrightBlue()
{
if (debugEnableColor)
{
- printf("%s", ANSI_BRIGHT_BLUE);
+ //printf("%s", ANSI_BRIGHT_BLUE);
}
}
void debugColourBrightRed()
{
if (debugEnableColor)
{
- printf("%s", ANSI_BRIGHT_RED);
+ //printf("%s", ANSI_BRIGHT_RED);
}
}
void debugColourDimBlue()
{
if (debugEnableColor)
{
- printf("%s", ANSI_DIM_BLUE);
+ //printf("%s", ANSI_DIM_BLUE);
}
}
diff --git a/rts/include/umlrtsignal.hh b/rts/include/umlrtsignal.hh
index 155210f..60edb0c 100644
--- a/rts/include/umlrtsignal.hh
+++ b/rts/include/umlrtsignal.hh
@@ -48,10 +48,8 @@
UMLRTSignal& operator=(const UMLRTSignal &signal);
~UMLRTSignal();
- typedef UMLRTSignalElement::Id Id;
- static const Id rtBound = 0;
- static const Id rtUnbound = 1;
- static const Id FIRST_PROTOCOL_SIGNAL_ID = 2;
+ typedef int Id;
+ enum { invalidSignalId = -1, rtBound = 0, rtUnbound, FIRST_PROTOCOL_SIGNAL_ID };
// Initialize a signal from the pool. This is where the signal-element is allocated.
// Before a signal is 'initialize'd, there is no element and the signal is deemed 'an invalid signal'.
diff --git a/rts/umlrt/umlrtbasicthread.cc b/rts/umlrt/umlrtbasicthread.cc
index 99a8d07..31fc9e9 100644
--- a/rts/umlrt/umlrtbasicthread.cc
+++ b/rts/umlrt/umlrtbasicthread.cc
@@ -53,7 +53,7 @@
{
FATAL_ERRNO("pthread_create");
}
-#ifdef __USE_GNU
+#if 0
// May not be universally available.
pthread_setname_np(tid, name); // Attempt this, but ignore errors.
#endif
diff --git a/rts/umlrt/umlrtmutex.cc b/rts/umlrt/umlrtmutex.cc
index 5a7ccd0..4a24598 100644
--- a/rts/umlrt/umlrtmutex.cc
+++ b/rts/umlrt/umlrtmutex.cc
@@ -47,6 +47,11 @@
}
// Timed - returns non-zero for success, zero for timeout.
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
int UMLRTMutex::take( uint32_t msec )
{
struct timespec timeout;
@@ -55,10 +60,7 @@
UMLRTTimespec::timespecAbsAddMsec( &timeout, msec );
if (pthread_mutex_timedlock(&mutex, &timeout) < 0)
{
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
int errno_ = errno;
-#pragma GCC diagnostic pop
if (errno_ != ETIMEDOUT)
{
FATAL_ERRNO("pthread_mutex_timedlock");
@@ -67,6 +69,9 @@
}
return success;
}
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
+#pragma GCC diagnostic pop
+#endif
// Give mutex back.
void UMLRTMutex::give()
diff --git a/rts/umlrt/umlrtsemaphore.cc b/rts/umlrt/umlrtsemaphore.cc
index 7768567..ed840ef 100644
--- a/rts/umlrt/umlrtsemaphore.cc
+++ b/rts/umlrt/umlrtsemaphore.cc
@@ -53,10 +53,14 @@
UMLRTTimespec::timespecAbsAddMsec( &timeout, msec );
if (sem_timedwait(&sem, &timeout) < 0)
{
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
int errno_ = errno;
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
#pragma GCC diagnostic pop
+#endif
if (errno_ != ETIMEDOUT)
{
perror("UMLRTSemaphore wait");