backed out epicsAssertPrintf() changes

This commit is contained in:
Jeff Hill
1999-08-31 21:41:01 +00:00
parent b8cded5774
commit 896a4e31a0
5 changed files with 15 additions and 180 deletions

View File

@@ -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 <stdlib.h>
@@ -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 ();
}

View File

@@ -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 <stdio.h>
#include <stdarg.h>
#include <string.h>
@@ -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);
}

View File

@@ -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 */

View File

@@ -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, "<Host with Unknown Address Type>", 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 ()
*/

View File

@@ -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 */