Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rosconsole: replaced 'while(0)' by 'while(false)' in ros/assert.h and ros/console.h #1179

Merged
merged 1 commit into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/rosconsole/include/ros/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@
do { \
ROS_FATAL("BREAKPOINT HIT\n\tfile = %s\n\tline=%d\n", __FILE__, __LINE__); \
ROS_ISSUE_BREAK() \
} while (0)
} while (false)

#define ROS_ASSERT(cond) \
do { \
if (!(cond)) { \
ROS_FATAL("ASSERTION FAILED\n\tfile = %s\n\tline = %d\n\tcond = %s\n", __FILE__, __LINE__, #cond); \
ROS_ISSUE_BREAK() \
} \
} while (0)
} while (false)

#define ROS_ASSERT_MSG(cond, ...) \
do { \
Expand All @@ -135,14 +135,14 @@
ROS_FATAL("\n"); \
ROS_ISSUE_BREAK(); \
} \
} while (0)
} while (false)

#define ROS_ASSERT_CMD(cond, cmd) \
do { \
if (!(cond)) { \
cmd; \
} \
} while (0)
} while (false)


#else
Expand Down
22 changes: 11 additions & 11 deletions tools/rosconsole/include/ros/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
{ \
::ros::console::initialize(); \
} \
} while(0)
} while(false)

#define ROSCONSOLE_DEFINE_LOCATION(cond, level, name) \
ROSCONSOLE_AUTOINIT; \
Expand Down Expand Up @@ -378,7 +378,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
{ \
ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, only if a given condition has been met, with stream-style formatting
Expand All @@ -397,7 +397,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
{ \
ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, only the first time it is hit when enabled, with printf-style formatting
Expand All @@ -415,7 +415,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
hit = true; \
ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
} \
} while(0)
} while(false)

// inside a macro which uses args use only well namespaced variable names in order to not overlay variables coming in via args
/**
Expand All @@ -434,7 +434,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
__ros_log_stream_once__hit__ = true; \
ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting
Expand All @@ -454,7 +454,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
last_hit = now.toSec(); \
ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
} \
} while(0)
} while(false)

// inside a macro which uses args use only well namespaced variable names in order to not overlay variables coming in via args
/**
Expand All @@ -475,7 +475,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
__ros_log_stream_throttle__last_hit__ = __ros_log_stream_throttle__now__.toSec(); \
ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting
Expand All @@ -495,7 +495,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
__ros_log_delayed_throttle__last_hit__ = __ros_log_delayed_throttle__now__.toSec(); \
ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
} \
} while(0)
} while(false)

// inside a macro which uses args use only well namespaced variable names in order to not overlay variables coming in via args
/**
Expand All @@ -516,7 +516,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
__ros_log_stream_delayed_throttle__last_hit__ = __ros_log_stream_delayed_throttle__now__.toSec(); \
ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, with user-defined filtering, with printf-style formatting
Expand All @@ -533,7 +533,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
{ \
ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(filter, __VA_ARGS__); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, with user-defined filtering, with stream-style formatting
Expand All @@ -550,7 +550,7 @@ ROSCONSOLE_DECL std::string formatToString(const char* fmt, ...);
{ \
ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER(filter, args); \
} \
} while(0)
} while(false)

/**
* \brief Log to a given named logger at a given verbosity level, with printf-style formatting
Expand Down