From 896a4e31a004a0288fdf5130542a0f2298612dc6 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 31 Aug 1999 21:41:01 +0000 Subject: [PATCH] backed out epicsAssertPrintf() changes --- src/libCom/assertUNIX.c | 50 ++----------------------- src/libCom/assertVX.c | 50 ++----------------------- src/libCom/epicsAssert.h | 25 ++----------- src/libCom/os/vxWorks/bsdSockResource.c | 45 ---------------------- src/libCom/osi/epicsAssert.h | 25 ++----------- 5 files changed, 15 insertions(+), 180 deletions(-) diff --git a/src/libCom/assertUNIX.c b/src/libCom/assertUNIX.c index 9c2c13289..20d47d160 100644 --- a/src/libCom/assertUNIX.c +++ b/src/libCom/assertUNIX.c @@ -24,36 +24,6 @@ * Advanced Photon Source * Argonne National Laboratory * - * Modification Log: - * ----------------- - * $Log$ - * Revision 1.11 1998/02/27 01:34:07 jhill - * cleaned up the DLL symbol export - * - * Revision 1.10 1998/01/20 21:36:51 mrk - * add dbDefs.h - * - * Revision 1.9 1997/05/01 19:57:09 jhill - * updated dll keywords - * - * Revision 1.8 1997/04/10 19:45:15 jhill - * API changes and include with not <> - * - * Revision 1.7 1997/01/22 22:06:49 jhill - * doc - * - * Revision 1.6 1996/11/02 01:56:55 jhill - * improved message - * - * Revision 1.5 1996/06/19 17:14:11 jhill - * print out the EPICS release when there is an assert failure - * - * Revision 1.4 1995/12/19 19:40:04 jhill - * added author name - * - * Revision 1.3 1995/08/12 00:59:11 jhill - * use $log in header - * */ #include @@ -67,28 +37,16 @@ #include "epicsVersion.h" #include "epicsAssert.h" - /* - * epicsAssertPrintf () + * epicsAssert () */ epicsShareFunc void epicsShareAPI - epicsAssertPrintf (const char *pFile, const unsigned line, - const char *pExp, const char *pAuthorName, const char *pFormat, ... - ) + epicsAssert (const char *pFile, const unsigned line, + const char *pExp, const char *pAuthorName) { - va_list pvar; - - va_start (pvar, pFormat); - epicsPrintf ( "\n\n\nA call to \"assert (%s)\" failed in %s line %d.\n", pExp, pFile, line); - if (pFormat) { - epicsPrintf ("When: "); - epicsVprintf (pFormat, pvar); - epicsPrintf ("\n"); - } - epicsPrintf ( "The file \"core\" will be created in the current working directory.\n"); @@ -118,8 +76,6 @@ epicsShareFunc void epicsShareAPI } epicsPrintf ("This problem occurred in \"%s\"\n", epicsReleaseVersion); - va_end (pvar); - abort (); } diff --git a/src/libCom/assertVX.c b/src/libCom/assertVX.c index 5234c52cd..f62f263c1 100644 --- a/src/libCom/assertVX.c +++ b/src/libCom/assertVX.c @@ -24,38 +24,10 @@ * Advanced Photon Source * Argonne National Laboratory * - * Modification Log: - * ----------------- - * $Log$ - * Revision 1.10 1998/02/27 01:34:07 jhill - * cleaned up the DLL symbol export - * - * Revision 1.9 1998/02/20 21:45:08 evans - * Made a large number of changes to epicsShareThings in libCom routines - * to get imports and exports straight on WIN32. Not everything is fixed - * at this time. - * - * Revision 1.8 1997/05/01 19:57:10 jhill - * updated dll keywords - * - * Revision 1.7 1997/04/10 19:45:16 jhill - * API changes and include with not <> - * - * Revision 1.6 1997/01/22 22:07:22 jhill - * doc - * - * Revision 1.5 1996/06/19 17:14:12 jhill - * print out the EPICS release when there is an assert failure - * - * Revision 1.4 1995/12/19 19:40:07 jhill - * added author name - * - * Revision 1.3 1995/08/12 01:00:07 jhill - * use $log in header * *************************************************************************** */ - + #include #include #include @@ -69,23 +41,17 @@ #include "epicsVersion.h" #include "epicsAssert.h" - - /* - * epicsAssertPrintf () + * epicsAssert () * * This forces assert failures into the log file and then * calls taskSuspend() instead of exit() so that we can debug * the problem. */ -void epicsAssertPrintf (const char *pFile, const unsigned line, const char *pExp, - const char *pAuthorName, const char *pFormat, ...) +void epicsAssert (const char *pFile, const unsigned line, const char *pExp, + const char *pAuthorName) { int taskId = taskIdSelf(); - va_list pvar; - - va_start (pvar, pFormat); - epicsPrintf ( "\n\n\n%s: A call to \"assert (%s)\" failed in %s at %d\n", @@ -94,12 +60,6 @@ void epicsAssertPrintf (const char *pFile, const unsigned line, const char *pExp pFile, line); - if (pFormat) { - epicsPrintf ("When: "); - epicsVprintf (pFormat, pvar); - epicsPrintf ("\n"); - } - if (pAuthorName) { epicsPrintf ( @@ -123,8 +83,6 @@ void epicsAssertPrintf (const char *pFile, const unsigned line, const char *pExp } epicsPrintf ("This problem occurred in \"%s\"\n", epicsReleaseVersion); - va_end (pvar); - taskSuspend (taskId); } diff --git a/src/libCom/epicsAssert.h b/src/libCom/epicsAssert.h index 3f98e27a2..d7c634f09 100644 --- a/src/libCom/epicsAssert.h +++ b/src/libCom/epicsAssert.h @@ -45,8 +45,6 @@ extern "C" { # define epicsAssertAuthor 0 #endif -#define assertParenStrip(ARG) ARG - #ifdef NDEBUG # define assert(ignore) ((void) 0) #else /* NDEBUG */ @@ -54,37 +52,22 @@ extern "C" { #if defined(__STDC__) || defined(__cplusplus) epicsShareFunc extern void epicsShareAPI - epicsAssertPrintf (const char *pFile, const unsigned line, - const char *pExp, const char *pAuthorName, const char *pFormat, ...); + epicsAssert (const char *pFile, const unsigned line, + const char *pExp, const char *pAuthorName); #else /*__STDC__ or __cplusplus*/ - epicsShareFunc extern void epicsShareAPI epicsAssert (); +epicsShareFunc extern void epicsShareAPI epicsAssert (); #endif /*__STDC__ or __cplusplus*/ #if (defined(__STDC__) || defined(__cplusplus)) && !defined(VAXC) #define assert(exp) \ -{if (!(exp)) epicsAssertPrintf (__FILE__, __LINE__, #exp, epicsAssertAuthor, 0);} - -/* - * Because C macros dont allow variable numbers of arguments we must - * use this as follows - * - * assertPrintf (a==b, ("bad news, a=%d b=%d", a, b) ); - */ -#define assertPrintf(exp, fmtAndArgsInParenthesis) \ - {if (!(exp)) {epicsAssertPrintf (__FILE__, __LINE__, #exp, epicsAssertAuthor, assertParenStrip fmtAndArgsInParenthesis);}} +{if (!(exp)) epicsAssert (__FILE__, __LINE__, #exp, epicsAssertAuthor);} #else /*__STDC__ or __cplusplus*/ -#define assert(exp) \ -{if (!(exp)) epicsAssertPrintf (__FILE__, __LINE__, "", epicsAssertAuthor, 0);} - -#define assertPrintf(exp, fmtAndArgsInParenthesis) \ - {if (!(exp)) {epicsAssertPrintf (__FILE__, __LINE__, "", epicsAssertAuthor, assertParenStrip fmtAndArgsInParenthesis);}} - #endif /* (__STDC__ or __cplusplus) and not VAXC */ #endif /* NDEBUG */ diff --git a/src/libCom/os/vxWorks/bsdSockResource.c b/src/libCom/os/vxWorks/bsdSockResource.c index 82c660a1c..cc34f0e70 100644 --- a/src/libCom/os/vxWorks/bsdSockResource.c +++ b/src/libCom/os/vxWorks/bsdSockResource.c @@ -63,51 +63,6 @@ epicsShareFunc unsigned epicsShareAPI ipAddrToHostName return len; } -/* - * sockAddrToA() - * (convert socket address to ASCII host name) - */ -void epicsShareAPI sockAddrToA - (const struct sockaddr *paddr, char *pBuf, unsigned bufSize) -{ - const int maxPortDigits = 5u; - char name[max(INET_ADDR_LEN,MAXHOSTNAMELEN)+1]; - int status; - int errnoCopy = errno; - - if (bufSize<1) { - return; - } - - if (paddr->sa_family!=AF_INET) { - strncpy(pBuf, "", bufSize-1); - /* - * force null termination - */ - pBuf[bufSize-1] = '\0'; - } - else { - struct sockaddr_in *paddr_in = (struct sockaddr_in *) paddr; - status = hostGetByAddr ((int)paddr_in->sin_addr.s_addr, name); - if (status!=OK) { - inet_ntoa_b (paddr_in->sin_addr, name); - } - - /* - * allow space for the port number - */ - if (bufSize>maxPortDigits+strlen(name)) { - sprintf (pBuf, "%.*s:%u", ((int)bufSize)-maxPortDigits-1, - name, ntohs(paddr_in->sin_port)); - } - else { - sprintf (pBuf, "%.*s", ((int)bufSize)-1, name); - } - } - - errno = errnoCopy; -} - /* * hostToIPAddr () */ diff --git a/src/libCom/osi/epicsAssert.h b/src/libCom/osi/epicsAssert.h index 3f98e27a2..d7c634f09 100644 --- a/src/libCom/osi/epicsAssert.h +++ b/src/libCom/osi/epicsAssert.h @@ -45,8 +45,6 @@ extern "C" { # define epicsAssertAuthor 0 #endif -#define assertParenStrip(ARG) ARG - #ifdef NDEBUG # define assert(ignore) ((void) 0) #else /* NDEBUG */ @@ -54,37 +52,22 @@ extern "C" { #if defined(__STDC__) || defined(__cplusplus) epicsShareFunc extern void epicsShareAPI - epicsAssertPrintf (const char *pFile, const unsigned line, - const char *pExp, const char *pAuthorName, const char *pFormat, ...); + epicsAssert (const char *pFile, const unsigned line, + const char *pExp, const char *pAuthorName); #else /*__STDC__ or __cplusplus*/ - epicsShareFunc extern void epicsShareAPI epicsAssert (); +epicsShareFunc extern void epicsShareAPI epicsAssert (); #endif /*__STDC__ or __cplusplus*/ #if (defined(__STDC__) || defined(__cplusplus)) && !defined(VAXC) #define assert(exp) \ -{if (!(exp)) epicsAssertPrintf (__FILE__, __LINE__, #exp, epicsAssertAuthor, 0);} - -/* - * Because C macros dont allow variable numbers of arguments we must - * use this as follows - * - * assertPrintf (a==b, ("bad news, a=%d b=%d", a, b) ); - */ -#define assertPrintf(exp, fmtAndArgsInParenthesis) \ - {if (!(exp)) {epicsAssertPrintf (__FILE__, __LINE__, #exp, epicsAssertAuthor, assertParenStrip fmtAndArgsInParenthesis);}} +{if (!(exp)) epicsAssert (__FILE__, __LINE__, #exp, epicsAssertAuthor);} #else /*__STDC__ or __cplusplus*/ -#define assert(exp) \ -{if (!(exp)) epicsAssertPrintf (__FILE__, __LINE__, "", epicsAssertAuthor, 0);} - -#define assertPrintf(exp, fmtAndArgsInParenthesis) \ - {if (!(exp)) {epicsAssertPrintf (__FILE__, __LINE__, "", epicsAssertAuthor, assertParenStrip fmtAndArgsInParenthesis);}} - #endif /* (__STDC__ or __cplusplus) and not VAXC */ #endif /* NDEBUG */