Skip to content

Commit 28e8af0

Browse files
committed
Don't catch/throw in --disable-exceptions examples
1 parent 03d595a commit 28e8af0

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

examples/adjoints/adjoints_ex1/adjoints_ex1.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ int main (int argc, char ** argv)
321321
// safely
322322
if (param.mesh_partitioner_type != "Default")
323323
{
324-
#ifndef LIBMESH_HAVE_RTTI
325-
libmesh_example_requires(false, "RTTI support");
324+
#if !defined(LIBMESH_HAVE_RTTI) || !defined(LIBMESH_ENABLE_EXCEPTIONS)
325+
libmesh_example_requires(false, "RTTI + exceptions support");
326326
#else
327327
// Factory failures are *verbose* in parallel; let's silence
328328
// cerr temporarily.
@@ -349,7 +349,7 @@ int main (int argc, char ** argv)
349349
libmesh_example_requires(false, param.mesh_partitioner_type + " partitioner support");
350350
}
351351
libMesh::err.rdbuf(oldbuf);
352-
#endif // LIBMESH_HAVE_RTI
352+
#endif // LIBMESH_HAVE_RTTI, LIBMESH_ENABLE_EXCEPTIONS
353353
}
354354

355355
// And an object to refine it

examples/adjoints/adjoints_ex5/adjoints_ex5.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ int main (int argc, char ** argv)
462462
// In optimized mode we catch any solver errors, so that we can
463463
// write the proper footers before closing. In debug mode we just
464464
// let the exception throw so that gdb can grab it.
465-
#ifdef NDEBUG
465+
#if defined(NDEBUG) && defined(LIBMESH_ENABLE_EXCEPTIONS)
466466
try
467-
{
468467
#endif
468+
{
469469
// Now we begin the timestep loop to compute the time-accurate
470470
// solution of the equations.
471471
for (unsigned int t_step=param.initial_timestep;
@@ -777,8 +777,8 @@ int main (int argc, char ** argv)
777777
libmesh_error_msg_if(std::abs(total_sensitivity - 4.83551) >= 2.e-4,
778778
"Mismatch in sensitivity gold value!");
779779
}
780-
#ifdef NDEBUG
781780
}
781+
#if defined(NDEBUG) && defined(LIBMESH_ENABLE_EXCEPTIONS)
782782
catch (...)
783783
{
784784
libMesh::err << '[' << mesh.processor_id()

examples/adjoints/adjoints_ex7/adjoints_ex7.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,10 @@ int main (int argc, char ** argv)
450450
// In optimized mode we catch any solver errors, so that we can
451451
// write the proper footers before closing. In debug mode we just
452452
// let the exception throw so that gdb can grab it.
453-
#ifdef NDEBUG
453+
#if defined(NDEBUG) && defined(LIBMESH_ENABLE_EXCEPTIONS)
454454
try
455-
{
456455
#endif
456+
{
457457
// Now we begin the timestep loop to compute the time-accurate
458458
// solution of the equations.
459459
for (unsigned int t_step=param.initial_timestep;
@@ -924,8 +924,8 @@ int main (int argc, char ** argv)
924924
libmesh_error_msg_if(std::abs(accumulated_QoI_spatially_integrated_error[1] - (-0.23895256319278346)) >= 2.e-4,
925925
"Error Estimator identity not satisfied!");
926926
}
927-
#ifdef NDEBUG
928927
}
928+
#if defined(NDEBUG) && defined(LIBMESH_ENABLE_EXCEPTIONS)
929929
catch (...)
930930
{
931931
libMesh::err << '[' << mesh.processor_id()

0 commit comments

Comments
 (0)