Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
bb1a6a7e
Commit
bb1a6a7e
authored
Dec 18, 2012
by
Uwe Schulzweida
Browse files
reshGetValue: added caller function name to error message
parent
b87fcac1
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
bb1a6a7e
2012-12-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* reshGetValue: added caller function name to error message
2012-12-17 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.5.9 released
...
...
src/pio_util.c
View file @
bb1a6a7e
...
...
@@ -18,8 +18,8 @@ char commands[][13] = { "FINALIZE\0",
"WRITETS
\0
"
};
void
pcdiAssert
(
bool
assumption
,
const
char
*
filename
,
const
char
*
functionname
,
int
line
)
void
pcdiAssert
(
bool
assumption
,
const
char
*
filename
,
const
char
*
functionname
,
int
line
)
{
if
(
!
assumption
)
{
...
...
@@ -45,6 +45,31 @@ void pcdiAssert ( bool assumption, const char * filename,
/****************************************************/
void
pcdiAbortC
(
const
char
*
caller
,
const
char
*
filename
,
const
char
*
functionname
,
int
line
,
const
char
*
errorString
,
...
)
{
va_list
ap
;
va_start
(
ap
,
errorString
);
#ifdef USE_MPI
{
int
rank
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
fprintf
(
stderr
,
"ERROR, pe%d in %s, %s, line %d, called from %s
\n
errorString:
\"
"
,
rank
,
functionname
,
filename
,
line
,
caller
);
}
vfprintf
(
stderr
,
errorString
,
ap
);
fputs
(
"
\"\n
"
,
stderr
);
MPI_Abort
(
MPI_COMM_WORLD
,
1
);
#else
fprintf
(
stderr
,
"ERROR, %s, %s, line %d, called from %s
\n
errorString:
\"
"
,
functionname
,
filename
,
line
,
caller
);
vfprintf
(
stderr
,
errorString
,
ap
);
fputs
(
"
\"\n
"
,
stderr
);
#endif
exit
(
EXIT_FAILURE
);
va_end
(
ap
);
}
void
pcdiAbort
(
const
char
*
filename
,
const
char
*
functionname
,
int
line
,
const
char
*
errorString
,
...
)
{
...
...
src/pio_util.h
View file @
bb1a6a7e
...
...
@@ -45,7 +45,7 @@
# define __attribute__(x)
/*NOTHING*/
#endif
void
pcdiAssert
(
bool
,
const
char
*
,
const
char
*
,
int
);
void
pcdiAssert
(
bool
,
const
char
*
,
const
char
*
,
int
);
#define xassert(arg) do { \
if ((arg)) { \
} else { \
...
...
@@ -129,6 +129,10 @@ char * outTextComm ( MPI_Comm * );
}
#endif
void
pcdiAbortC
(
const
char
*
,
const
char
*
,
const
char
*
,
int
,
const
char
*
,
...
)
__attribute__
((
noreturn
));
#define xabortC(caller, ...) pcdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ )
void
pcdiAbort
(
const
char
*
,
const
char
*
,
int
,
const
char
*
,
...
)
__attribute__
((
noreturn
));
#define xabort(...) pcdiAbort(__FILE__, __func__, __LINE__, __VA_ARGS__ )
...
...
src/resource_handle.c
View file @
bb1a6a7e
...
...
@@ -282,7 +282,7 @@ void reshRemove ( cdiResH resH, resOps * ops )
/**************************************************************/
void
*
reshGetVal
(
cdiResH
resH
,
resOps
*
ops
)
void
*
reshGetVal
ue
(
const
char
*
caller
,
cdiResH
resH
,
resOps
*
ops
)
{
int
nsp
;
namespaceTuple_t
nspT
;
...
...
@@ -298,9 +298,8 @@ void *reshGetVal ( cdiResH resH, resOps * ops )
nspT
=
namespaceResHDecode
(
resH
);
if
(
nspT
.
nsp
==
nsp
&&
nspT
.
idx
>=
0
&&
nspT
.
idx
<
listSizeAllocated
[
nsp
])
if
(
nspT
.
nsp
==
nsp
&&
nspT
.
idx
>=
0
&&
nspT
.
idx
<
listSizeAllocated
[
nsp
]
)
{
listElem
=
listResources
[
nsp
]
+
nspT
.
idx
;
LIST_UNLOCK
();
...
...
@@ -308,10 +307,11 @@ void *reshGetVal ( cdiResH resH, resOps * ops )
else
{
LIST_UNLOCK
();
xabort
(
"Invalid namespace %d or index %d for res
H
%d!"
,
nspT
.
nsp
,
nspT
.
idx
,
(
int
)
resH
);
xabort
C
(
caller
,
"Invalid namespace %d or index %d for res
ource handle
%d!"
,
nspT
.
nsp
,
nspT
.
idx
,
(
int
)
resH
);
}
xassert
(
listElem
&&
listElem
->
ops
==
ops
);
if
(
!
(
listElem
&&
listElem
->
ops
==
ops
)
)
xabortC
(
caller
,
"Invalid resource handle %d, list element not found!"
,
(
int
)
resH
);
return
listElem
->
val
;
}
...
...
src/resource_handle.h
View file @
bb1a6a7e
...
...
@@ -47,7 +47,8 @@ void reshRemove ( cdiResH, resOps * );
int
reshCountType
(
resOps
*
);
void
*
reshGetVal
(
cdiResH
,
resOps
*
);
void
*
reshGetValue
(
const
char
*
,
cdiResH
,
resOps
*
);
#define reshGetVal(resH, ops) reshGetValue(__func__, resH, ops)
void
reshGetResHListOfType
(
int
,
int
*
,
resOps
*
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment