Skip to content

Commit 049298f

Browse files
authored
Normalize extern "C" guards to #ifdef __cplusplus (ros2#585)
char_array.h, uint8_array.h, and time.c used `#if __cplusplus`, while all other headers (~33 sites) use `#ifdef __cplusplus`. Align the three outliers to the dominant convention, avoiding the -Wundef diagnostics these guards triggered. No behavioral change. Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
1 parent fea4b4f commit 049298f

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎include/rcutils/types/char_array.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef RCUTILS__TYPES__CHAR_ARRAY_H_
1818
#define RCUTILS__TYPES__CHAR_ARRAY_H_
1919

20-
#if __cplusplus
20+
#ifdef __cplusplus
2121
extern "C"
2222
{
2323
#endif
@@ -239,7 +239,7 @@ RCUTILS_WARN_UNUSED
239239
rcutils_ret_t
240240
rcutils_char_array_strcpy(rcutils_char_array_t * char_array, const char * src);
241241

242-
#if __cplusplus
242+
#ifdef __cplusplus
243243
}
244244
#endif
245245

‎include/rcutils/types/uint8_array.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef RCUTILS__TYPES__UINT8_ARRAY_H_
1818
#define RCUTILS__TYPES__UINT8_ARRAY_H_
1919

20-
#if __cplusplus
20+
#ifdef __cplusplus
2121
extern "C"
2222
{
2323
#endif
@@ -114,7 +114,7 @@ RCUTILS_WARN_UNUSED
114114
rcutils_ret_t
115115
rcutils_uint8_array_resize(rcutils_uint8_array_t * uint8_array, size_t new_size);
116116

117-
#if __cplusplus
117+
#ifdef __cplusplus
118118
}
119119
#endif
120120

‎src/time.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#if __cplusplus
15+
#ifdef __cplusplus
1616
extern "C"
1717
{
1818
#endif
@@ -123,6 +123,6 @@ rcutils_time_point_value_as_seconds_string(
123123
return RCUTILS_RET_OK;
124124
}
125125

126-
#if __cplusplus
126+
#ifdef __cplusplus
127127
}
128128
#endif

0 commit comments

Comments
 (0)