Skip to content

Commit

Permalink
Change #if to #ifdef.
Browse files Browse the repository at this point in the history
Needed because you can't use preprocessor on undefined variables in
MISRA.
  • Loading branch information
mjcarroll committed May 1, 2018
1 parent 5142a8a commit f8c7755
Show file tree
Hide file tree
Showing 48 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions rcl/include/rcl/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__ALLOCATOR_H_
#define RCL__ALLOCATOR_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand All @@ -34,7 +34,7 @@ typedef rcutils_allocator_t rcl_allocator_t;
#define RCL_CHECK_ALLOCATOR_WITH_MSG(allocator, msg, fail_statement) \
RCUTILS_CHECK_ALLOCATOR_WITH_MSG(allocator, msg, fail_statement)

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "rcl/types.h"
#include "rcl/visibility_control.h"

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -248,7 +248,7 @@ RCL_WARN_UNUSED
rcl_arguments_t *
rcl_get_global_arguments();

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__CLIENT_H_
#define RCL__CLIENT_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -398,7 +398,7 @@ RCL_PUBLIC
bool
rcl_client_is_valid(const rcl_client_t * client, rcl_allocator_t * error_msg_allocator);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/expand_topic_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__EXPAND_TOPIC_NAME_H_
#define RCL__EXPAND_TOPIC_NAME_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -137,7 +137,7 @@ RCL_WARN_UNUSED
rcl_ret_t
rcl_get_default_topic_name_substitutions(rcutils_string_map_t * string_map);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__GRAPH_H_
#define RCL__GRAPH_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -349,7 +349,7 @@ rcl_service_server_is_available(
const rcl_client_t * client,
bool * is_available);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/guard_condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__GUARD_CONDITION_H_
#define RCL__GUARD_CONDITION_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -245,7 +245,7 @@ RCL_WARN_UNUSED
rmw_guard_condition_t *
rcl_guard_condition_get_rmw_handle(const rcl_guard_condition_t * guard_condition);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__MACROS_H_
#define RCL__MACROS_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand All @@ -27,7 +27,7 @@ extern "C"
# define RCL_WARN_UNUSED _Check_return_
#endif

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__NODE_H_
#define RCL__NODE_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -516,7 +516,7 @@ RCL_WARN_UNUSED
const char *
rcl_node_get_logger_name(const rcl_node_t * node);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__PUBLISHER_H_
#define RCL__PUBLISHER_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -363,7 +363,7 @@ rcl_publisher_is_valid(
const rcl_publisher_t * publisher,
rcl_allocator_t * error_msg_allocator);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/rcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#ifndef RCL__RCL_H_
#define RCL__RCL_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -193,7 +193,7 @@ RCL_WARN_UNUSED
bool
rcl_ok(void);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "rcl/types.h"
#include "rcl/visibility_control.h"

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -232,7 +232,7 @@ rcl_remap_node_namespace(
rcl_allocator_t allocator,
char ** output_namespace);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__SERVICE_H_
#define RCL__SERVICE_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -410,7 +410,7 @@ RCL_PUBLIC
bool
rcl_service_is_valid(const rcl_service_t * service, rcl_allocator_t * error_msg_allocator);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__SUBSCRIPTION_H_
#define RCL__SUBSCRIPTION_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -367,7 +367,7 @@ rcl_subscription_is_valid(
const rcl_subscription_t * subscription,
rcl_allocator_t * error_msg_allocator);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__TIME_H_
#define RCL__TIME_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -358,7 +358,7 @@ rcl_ret_t
rcl_set_ros_time_override(
rcl_clock_t * clock, rcl_time_point_value_t time_value);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__TIMER_H_
#define RCL__TIMER_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -526,7 +526,7 @@ rcl_timer_reset(rcl_timer_t * timer);
const rcl_allocator_t *
rcl_timer_get_allocator(const rcl_timer_t * timer);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/validate_topic_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__VALIDATE_TOPIC_NAME_H_
#define RCL__VALIDATE_TOPIC_NAME_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -116,7 +116,7 @@ RCL_WARN_UNUSED
const char *
rcl_topic_name_validation_result_string(int validation_result);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/visibility_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__VISIBILITY_CONTROL_H_
#define RCL__VISIBILITY_CONTROL_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -51,7 +51,7 @@ extern "C"
#define RCL_PUBLIC_TYPE
#endif

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef RCL__WAIT_H_
#define RCL__WAIT_H_

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -501,7 +501,7 @@ RCL_WARN_UNUSED
rcl_ret_t
rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout);

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/src/rcl/arguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "rmw/validate_namespace.h"
#include "rmw/validate_node_name.h"

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -843,6 +843,6 @@ _rcl_parse_remap_rule(
return ret;
}

#if __cplusplus
#ifdef __cplusplus
}
#endif
4 changes: 2 additions & 2 deletions rcl/src/rcl/arguments_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "rcl/arguments.h"
#include "./remap_impl.h"

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand All @@ -40,7 +40,7 @@ typedef struct rcl_arguments_impl_t
rcl_allocator_t allocator;
} rcl_arguments_impl_t;

#if __cplusplus
#ifdef __cplusplus
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions rcl/src/rcl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -331,6 +331,6 @@ rcl_client_is_valid(const rcl_client_t * client, rcl_allocator_t * error_msg_all
client->impl->rmw_handle, "client's rmw handle is invalid", return false, alloc);
return true;
}
#if __cplusplus
#ifdef __cplusplus
}
#endif
4 changes: 2 additions & 2 deletions rcl/src/rcl/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif
Expand Down Expand Up @@ -68,6 +68,6 @@ rcl_convert_rmw_ret_to_rcl_ret(rmw_ret_t rmw_ret)
}
}

#if __cplusplus
#ifdef __cplusplus
}
#endif
Loading

0 comments on commit f8c7755

Please sign in to comment.