From 5a01521f9e498a97ae6cd4e9ce69d8459a5041e7 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sat, 21 Sep 2013 15:36:04 +0200 Subject: [PATCH] Fix most of warnings reported by GCC 4.7 on x86_64 and GCC 4.8.1 RTEMS ARM based systems. Signed-off-by: Pavel Pisa --- orte/examples/hello/h_publisher.c | 3 +++ orte/examples/hello/h_subscriber.c | 3 +++ orte/examples/multicast/m_subscriber.c | 5 ++++- orte/examples/ping/orteping.c | 20 +++++++++++++++++-- orte/examples/reliable/r_publisher.c | 4 ++++ .../reliable/r_subscriber_besteffort.c | 4 ++++ .../examples/reliable/r_subscriber_reliable.c | 4 ++++ .../examples/schneider/schneider_subscriber.c | 5 ++++- orte/liborte/sock.c | 2 +- orte/manager/ortemanager.c | 17 ++++++++++++++-- 10 files changed, 60 insertions(+), 7 deletions(-) diff --git a/orte/examples/hello/h_publisher.c b/orte/examples/hello/h_publisher.c index ab7e459..04774f8 100644 --- a/orte/examples/hello/h_publisher.c +++ b/orte/examples/hello/h_publisher.c @@ -82,6 +82,9 @@ publisherCreate(void *arg) { sendCallBack, NULL, &delay); + if (p == NULL) { + printf("ORTEPublicationCreate failed\n"); + } return arg; } diff --git a/orte/examples/hello/h_subscriber.c b/orte/examples/hello/h_subscriber.c index 6cfe38e..de80314 100644 --- a/orte/examples/hello/h_subscriber.c +++ b/orte/examples/hello/h_subscriber.c @@ -84,6 +84,9 @@ subscriberCreate(void *arg) { recvCallBack, NULL, IPADDRESS_INVALID); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + } return arg; } diff --git a/orte/examples/multicast/m_subscriber.c b/orte/examples/multicast/m_subscriber.c index 819ba3e..8b283da 100644 --- a/orte/examples/multicast/m_subscriber.c +++ b/orte/examples/multicast/m_subscriber.c @@ -39,7 +39,7 @@ static ORTEDomain *d = NULL; static char instance2Recv[64]; -int maxDataSize(ORTEGetMaxSizeParam *gms) { +int maxDataSize(ORTEGetMaxSizeParam *gms, int num) { return gms->max_size; } @@ -78,6 +78,9 @@ subscriberCreate(void *arg) { recvCallBack, NULL, StringToIPAddress("225.0.0.2")); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + } return arg; } diff --git a/orte/examples/ping/orteping.c b/orte/examples/ping/orteping.c index 575feea..08f72be 100644 --- a/orte/examples/ping/orteping.c +++ b/orte/examples/ping/orteping.c @@ -46,6 +46,14 @@ #include #endif +#ifdef HAVE_INTTYPES_H + #include +#endif /*HAVE_INTTYPES_H*/ + +#ifndef PRIu32 + #define PRIu32 x +#endif + #ifdef MAIN_RENAMED #define main orte_ping_main #define exit return @@ -68,7 +76,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) switch (info->status) { case NEW_DATA: if (!quite) - printf("received fresh issue %d\n",*instance); + printf("received fresh issue %"PRIu32"\n",*instance); break; case DEADLINE: printf("deadline occurred\n"); @@ -84,7 +92,7 @@ sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) case NEED_DATA: (*instance)++; if (!quite) - printf("sent issue %d\n",*instance); + printf("sent issue %"PRIu32"\n",*instance); break; case CQL: //criticalQueueLevel break; @@ -239,6 +247,10 @@ int main(int argc,char *argv[]) { sendCallBack, NULL, &delay); + if (p == NULL) { + printf("ORTEPublicationCreate failed\n"); + exit(1); + } } if (haveSubscriber) { NTPTIME_BUILD(deadline,3); @@ -254,6 +266,10 @@ int main(int argc,char *argv[]) { recvCallBack, NULL, smIPAddress); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + exit(1); + } } //never ending loop while (!regfail) diff --git a/orte/examples/reliable/r_publisher.c b/orte/examples/reliable/r_publisher.c index 98ce879..7f9408f 100644 --- a/orte/examples/reliable/r_publisher.c +++ b/orte/examples/reliable/r_publisher.c @@ -79,6 +79,10 @@ main(int argc, char *args[]) { sendCallBack, NULL, &repeating); + if (p == NULL) { + printf("ORTEPublicationCreate failed\n"); + return 1; + } #ifndef CONFIG_ORTE_RT while(1) { ORTESleepMs(1000); diff --git a/orte/examples/reliable/r_subscriber_besteffort.c b/orte/examples/reliable/r_subscriber_besteffort.c index 5ab3345..c72cfdf 100644 --- a/orte/examples/reliable/r_subscriber_besteffort.c +++ b/orte/examples/reliable/r_subscriber_besteffort.c @@ -81,6 +81,10 @@ main(int argc, char *args[]) { recvCallBack, NULL, IPADDRESS_INVALID); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + return 1; + } #ifndef CONFIG_ORTE_RT while (1) ORTESleepMs(1000); diff --git a/orte/examples/reliable/r_subscriber_reliable.c b/orte/examples/reliable/r_subscriber_reliable.c index 354c609..084b46f 100644 --- a/orte/examples/reliable/r_subscriber_reliable.c +++ b/orte/examples/reliable/r_subscriber_reliable.c @@ -81,6 +81,10 @@ main(int argc, char *args[]) { recvCallBack, NULL, IPADDRESS_INVALID); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + return 1; + } #ifndef CONFIG_ORTE_RT while (1) ORTESleepMs(1000); diff --git a/orte/examples/schneider/schneider_subscriber.c b/orte/examples/schneider/schneider_subscriber.c index d0452ae..a320f2b 100644 --- a/orte/examples/schneider/schneider_subscriber.c +++ b/orte/examples/schneider/schneider_subscriber.c @@ -39,7 +39,7 @@ static ORTEDomain *d = NULL; static char instance2Recv[64]; -int maxDataSize(ORTEGetMaxSizeParam *gms) { +int maxDataSize(ORTEGetMaxSizeParam *gms, int num) { return gms->max_size; } @@ -80,6 +80,9 @@ subscriberCreate(void *arg) { // StringToIPAddress("225.0.0.2") IPADDRESS_INVALID ); + if (s == NULL) { + printf("ORTESubscriptionCreate failed\n"); + } return arg; } diff --git a/orte/liborte/sock.c b/orte/liborte/sock.c index 12b9c59..a5818e5 100644 --- a/orte/liborte/sock.c +++ b/orte/liborte/sock.c @@ -210,7 +210,7 @@ sock_get_local_interfaces(sock_t *sock,ORTEIFProp *IFProp,char *IFCount) { } freeifaddrs(ifa); - + return 0; #elif defined(SOCK_BSD) #define SOCK_SIOCGIFCONF_SA_LEN_UNCONDITIONAL 1 /* seems to be required for RTEMS*/ diff --git a/orte/manager/ortemanager.c b/orte/manager/ortemanager.c index 910df3b..bc42bfe 100644 --- a/orte/manager/ortemanager.c +++ b/orte/manager/ortemanager.c @@ -31,6 +31,19 @@ #include "orte_all.h" +#ifdef HAVE_INTTYPES_H + #include + #if defined(PRIx32) && !defined(ORTE_PRI_HostId) + #define ORTE_PRI_HostId PRIx32 + #define ORTE_PRI_AppId PRIx32 + #endif +#endif /*HAVE_INTTYPES_H*/ + +#ifndef ORTE_PRI_HostId + #define ORTE_PRI_HostId x + #define ORTE_PRI_AppId x +#endif + #ifdef MAIN_RENAMED #define main ortemanager_main #define exit return @@ -48,7 +61,7 @@ static ORTEDomainAppEvents *events=NULL; //event system Boolean onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param) { - printf("%s 0x%x-0x%x was accepted\n", + printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was accepted\n", (appInfo->appId & 0x3)==MANAGER ? "manager" : "application", appInfo->hostId,appInfo->appId); return ORTE_TRUE; @@ -56,7 +69,7 @@ onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param) { void onMgrAppDelete(const struct ORTEAppInfo *appInfo, void *param) { - printf("%s 0x%x-0x%x was deleted\n", + printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was deleted\n", (appInfo->appId & 0x3)==MANAGER ? "manager" : "application", appInfo->hostId,appInfo->appId); } -- 2.39.2