aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2016-07-04 18:42:25 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-07-05 15:09:30 +0300
commitd1d06aa241b97e2f1919ee990168a21319a66143 (patch)
tree61ece42b34c19ecc0692087a9ef179e287037016
parentc2784fbafbf8a29b6daa48429133e25b777536cf (diff)
linux-gen: std_types: remove extra c headers
Removed C header includes which are not needed for API definitions. ODP API depends on uint64_t, etc types in stdint.h, but not other C headers. As an exception, stdbool.h remains since 'true' and 'false' definitions may be used with odp_bool_t. It could be also removed later since true/false are not part of the API (where as uint64_t, etc types). Application needs to include other C library headers directly. ODP API does not specify which headers are included by odp_api.h. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--example/classifier/odp_classifier.c1
-rw-r--r--example/generator/odp_generator.c1
-rw-r--r--example/ipsec/odp_ipsec.c1
-rw-r--r--example/packet/odp_pktio.c1
-rw-r--r--example/switch/odp_switch.c2
-rw-r--r--example/time/time_global_test.c1
-rw-r--r--example/timer/odp_timer_simple.c1
-rw-r--r--example/timer/odp_timer_test.c1
-rw-r--r--helper/chksum.c2
-rw-r--r--helper/linux.c1
-rw-r--r--platform/linux-generic/include/odp/api/std_types.h8
-rw-r--r--platform/linux-generic/include/odp_atomic_internal.h1
-rw-r--r--platform/linux-generic/include/odp_buffer_internal.h1
-rw-r--r--platform/linux-generic/include/odp_packet_socket.h1
-rw-r--r--platform/linux-generic/odp_buffer.c2
-rw-r--r--platform/linux-generic/odp_classification.c1
-rw-r--r--platform/linux-generic/odp_hash.c2
-rw-r--r--platform/linux-generic/odp_packet.c1
-rw-r--r--platform/linux-generic/odp_packet_io.c1
-rw-r--r--platform/linux-generic/odp_pkt_queue.c1
-rw-r--r--platform/linux-generic/odp_pool.c2
-rw-r--r--platform/linux-generic/odp_queue.c2
-rw-r--r--platform/linux-generic/odp_shared_memory.c1
-rw-r--r--platform/linux-generic/odp_sorted_list.c1
-rw-r--r--platform/linux-generic/odp_system_info.c1
-rw-r--r--platform/linux-generic/odp_timer.c1
-rw-r--r--platform/linux-generic/odp_timer_wheel.c1
-rw-r--r--platform/linux-generic/odp_traffic_mngr.c2
-rw-r--r--platform/linux-generic/pktio/loop.c2
-rw-r--r--platform/linux-generic/pktio/netmap.c2
-rw-r--r--platform/linux-generic/pktio/ring.c2
-rw-r--r--platform/linux-generic/pktio/sysfs.c1
-rw-r--r--platform/linux-generic/pktio/tap.c1
-rw-r--r--test/performance/odp_l2fwd.c1
-rw-r--r--test/performance/odp_pktio_perf.c1
-rw-r--r--test/performance/odp_scheduling.c1
-rw-r--r--test/platform/linux-generic/pktio_ipc/ipc_common.h1
-rw-r--r--test/validation/classification/odp_classification_testsuites.h1
-rw-r--r--test/validation/common/mask_common.c2
-rw-r--r--test/validation/common/odp_cunit_common.h1
40 files changed, 50 insertions, 8 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 20e64ece3..1bd241418 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -8,6 +8,7 @@
#include <string.h>
#include <getopt.h>
#include <unistd.h>
+#include <inttypes.h>
#include <example_debug.h>
#include <odp_api.h>
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 8393244e4..3fea112d0 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
+#include <inttypes.h>
#include <sys/time.h>
#include <example_debug.h>
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 451bb2d5a..d8ca791c9 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
+#include <inttypes.h>
#include <example_debug.h>
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 564c63ac6..6e14abb21 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -8,6 +8,7 @@
#include <string.h>
#include <getopt.h>
#include <unistd.h>
+#include <inttypes.h>
#include <example_debug.h>
diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c
index 09835c09f..5ce71a9ed 100644
--- a/example/switch/odp_switch.c
+++ b/example/switch/odp_switch.c
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <getopt.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <inttypes.h>
#include <odp_api.h>
#include <odp/helper/linux.h>
diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c
index 372d96bb4..380ec5200 100644
--- a/example/time/time_global_test.c
+++ b/example/time/time_global_test.c
@@ -7,6 +7,7 @@
#include <odp_api.h>
#include <example_debug.h>
#include <odp/helper/linux.h>
+#include <inttypes.h>
#define MAX_WORKERS 32
#define ITERATION_NUM 2048
diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c
index f33add912..98c08ce4c 100644
--- a/example/timer/odp_timer_simple.c
+++ b/example/timer/odp_timer_simple.c
@@ -12,6 +12,7 @@
#include <string.h>
#include <stdlib.h>
+#include <inttypes.h>
#include <example_debug.h>
/* ODP main header */
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index cb58dfe4c..035ab2e0e 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <stdlib.h>
+#include <inttypes.h>
#include <example_debug.h>
diff --git a/helper/chksum.c b/helper/chksum.c
index 859d1ec96..8f1888148 100644
--- a/helper/chksum.c
+++ b/helper/chksum.c
@@ -9,6 +9,8 @@
#include <odp/helper/udp.h>
#include <odp/helper/tcp.h>
#include <odp/helper/chksum.h>
+#include <stddef.h>
+#include <stdbool.h>
/* The following union type is used to "view" an ordered set of bytes (either
* 2 or 4) as 1 or 2 16-bit quantities - using host endian order. */
diff --git a/helper/linux.c b/helper/linux.c
index a1dbe525a..bb4b22c9b 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <stdbool.h>
#include <odp_api.h>
#include <odp/helper/linux.h>
diff --git a/platform/linux-generic/include/odp/api/std_types.h b/platform/linux-generic/include/odp/api/std_types.h
index d4eeb5d55..b61f33f4c 100644
--- a/platform/linux-generic/include/odp/api/std_types.h
+++ b/platform/linux-generic/include/odp/api/std_types.h
@@ -17,13 +17,11 @@
extern "C" {
#endif
-#include <stdlib.h>
+/* uint64_t, uint32_t, etc */
#include <stdint.h>
-#include <stddef.h>
+
+/* true and false for odp_bool_t */
#include <stdbool.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <limits.h>
/** @addtogroup odp_system ODP SYSTEM
* @{
diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h
index 67e8f825c..dca2175ce 100644
--- a/platform/linux-generic/include/odp_atomic_internal.h
+++ b/platform/linux-generic/include/odp_atomic_internal.h
@@ -20,6 +20,7 @@
#include <odp/api/align.h>
#include <odp/api/hints.h>
#include <odp/api/atomic.h>
+#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index a427a806f..f21364c36 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -31,6 +31,7 @@ extern "C" {
#include <odp/api/event.h>
#include <odp_forward_typedefs_internal.h>
#include <odp_schedule_if.h>
+#include <stddef.h>
#define ODP_BITSIZE(x) \
((x) <= 2 ? 1 : \
diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h
index 09a571b63..ccff69a56 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -12,6 +12,7 @@
#include <linux/if_ether.h>
#include <sys/socket.h>
#include <string.h>
+#include <stddef.h>
#include <odp/api/align.h>
#include <odp/api/buffer.h>
diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c
index 69f913d25..e7e4d58e4 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -12,7 +12,7 @@
#include <string.h>
#include <stdio.h>
-
+#include <inttypes.h>
odp_buffer_t odp_buffer_from_event(odp_event_t ev)
{
diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 0602a6226..027a7ce0e 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -21,6 +21,7 @@
#include <odp/helper/eth.h>
#include <string.h>
#include <errno.h>
+#include <stdbool.h>
#include <odp/api/spinlock.h>
#define LOCK(a) odp_spinlock_lock(a)
diff --git a/platform/linux-generic/odp_hash.c b/platform/linux-generic/odp_hash.c
index 0e092824d..55876c338 100644
--- a/platform/linux-generic/odp_hash.c
+++ b/platform/linux-generic/odp_hash.c
@@ -40,6 +40,8 @@
#include <odp/api/hash.h>
#include <odp/api/std_types.h>
+#include <stddef.h>
+
static const uint32_t crc32c_tables[8][256] = {{
0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, 0xC79A971F, 0x35F1141C,
0x26A1E7E8, 0xD4CA64EB, 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B,
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 9f8107340..0a868e912 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
+#include <inttypes.h>
/*
*
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 5b202e791..0b9939bd3 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -24,6 +24,7 @@
#include <odp/api/time.h>
#include <string.h>
+#include <inttypes.h>
#include <sys/ioctl.h>
#include <ifaddrs.h>
#include <errno.h>
diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c
index cbe1e7485..7734ee983 100644
--- a/platform/linux-generic/odp_pkt_queue.c
+++ b/platform/linux-generic/odp_pkt_queue.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <malloc.h>
#include <stdio.h>
+#include <inttypes.h>
#include <odp_api.h>
#include <odp_pkt_queue_internal.h>
#include <odp_debug_internal.h>
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 5ed7080a4..ec6d86aa4 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <stdlib.h>
-
+#include <inttypes.h>
#if ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS
#error ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 1166a723d..bec1e51db 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -42,7 +42,7 @@
#endif
#include <string.h>
-
+#include <inttypes.h>
typedef struct queue_table_t {
queue_entry_t queue[ODP_CONFIG_QUEUES];
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index f432cf92b..550af2718 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <inttypes.h>
ODP_STATIC_ASSERT(ODP_CONFIG_SHM_BLOCKS >= ODP_CONFIG_POOLS,
"ODP_CONFIG_SHM_BLOCKS < ODP_CONFIG_POOLS");
diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c
index 554494b88..8a1dc3ac9 100644
--- a/platform/linux-generic/odp_sorted_list.c
+++ b/platform/linux-generic/odp_sorted_list.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <malloc.h>
#include <stdio.h>
+#include <inttypes.h>
#include <odp_debug_internal.h>
#include <odp_sorted_list_internal.h>
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index fca35ce30..bbe5358ed 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -15,6 +15,7 @@
#include <sched.h>
#include <string.h>
#include <stdio.h>
+#include <inttypes.h>
/* sysconf */
#include <unistd.h>
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 996edf040..becea9d5c 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -28,6 +28,7 @@
#include <pthread.h>
#include <unistd.h>
#include <sys/syscall.h>
+#include <inttypes.h>
#include <odp/api/align.h>
#include <odp_align_internal.h>
diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
index 865dd7ed6..f2c802a85 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <malloc.h>
#include <stdio.h>
+#include <inttypes.h>
#include <odp_timer_wheel_internal.h>
#include <odp_traffic_mngr_internal.h>
#include <odp_debug_internal.h>
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
index 681df00b0..9cfa1fc84 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -11,6 +11,8 @@
#include <string.h>
#include <malloc.h>
#include <stdio.h>
+#include <stdbool.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sched.h>
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index dce33e5da..1febacdc1 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -16,6 +16,8 @@
#include <odp/helper/ip.h>
#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
/* MAC address for the "loop" interface */
static const char pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01};
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 847250bf2..08e49f419 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -22,6 +22,8 @@
#include <odp_classification_inlines.h>
#include <odp_classification_internal.h>
+#include <inttypes.h>
+
/* Disable netmap debug prints */
#ifndef ND
#define ND(_fmt, ...) do {} while (0)
diff --git a/platform/linux-generic/pktio/ring.c b/platform/linux-generic/pktio/ring.c
index ec27f2c14..3024f4a36 100644
--- a/platform/linux-generic/pktio/ring.c
+++ b/platform/linux-generic/pktio/ring.c
@@ -73,6 +73,8 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <stdbool.h>
+#include <inttypes.h>
#include "odph_debug.h"
#include <odp_packet_io_ring_internal.h>
#include <odp_internal.h>
diff --git a/platform/linux-generic/pktio/sysfs.c b/platform/linux-generic/pktio/sysfs.c
index 7aadc14a6..be0822ddd 100644
--- a/platform/linux-generic/pktio/sysfs.c
+++ b/platform/linux-generic/pktio/sysfs.c
@@ -8,6 +8,7 @@
#include <odp_packet_io_internal.h>
#include <errno.h>
#include <string.h>
+#include <inttypes.h>
static int sysfs_get_val(const char *fname, uint64_t *val)
{
diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c
index 8ba7bed8e..a9a8886f6 100644
--- a/platform/linux-generic/pktio/tap.c
+++ b/platform/linux-generic/pktio/tap.c
@@ -33,6 +33,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
+#include <stdbool.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 2ceee74ff..164f7f5e0 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -19,6 +19,7 @@
#include <getopt.h>
#include <unistd.h>
#include <errno.h>
+#include <inttypes.h>
#include <test_debug.h>
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 98ec681eb..18a1aa2a2 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <inttypes.h>
#include <test_debug.h>
#define PKT_BUF_NUM 8192
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index c575b70df..bd37f9bd4 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -12,6 +12,7 @@
#include <string.h>
#include <stdlib.h>
+#include <inttypes.h>
#include <test_debug.h>
diff --git a/test/platform/linux-generic/pktio_ipc/ipc_common.h b/test/platform/linux-generic/pktio_ipc/ipc_common.h
index 7bc483f78..a6b7c581b 100644
--- a/test/platform/linux-generic/pktio_ipc/ipc_common.h
+++ b/test/platform/linux-generic/pktio_ipc/ipc_common.h
@@ -6,6 +6,7 @@
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
+#include <inttypes.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
index 023a26721..aea3de1b1 100644
--- a/test/validation/classification/odp_classification_testsuites.h
+++ b/test/validation/classification/odp_classification_testsuites.h
@@ -9,6 +9,7 @@
#include <odp_api.h>
#include <odp_cunit_common.h>
+#include <stdbool.h>
extern odp_testinfo_t classification_suite[];
extern odp_testinfo_t classification_suite_basic[];
diff --git a/test/validation/common/mask_common.c b/test/validation/common/mask_common.c
index 500136499..b31534c64 100644
--- a/test/validation/common/mask_common.c
+++ b/test/validation/common/mask_common.c
@@ -9,6 +9,8 @@
#include "odp_cunit_common.h"
#include "mask_common.h"
+#include <stdlib.h>
+
/*
* The following strings are used to build masks with odp_*mask_from_str().
* Both 0x prefixed and non prefixed hex values are supported.
diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h
index 52fe203a4..486a5ec51 100644
--- a/test/validation/common/odp_cunit_common.h
+++ b/test/validation/common/odp_cunit_common.h
@@ -14,6 +14,7 @@
#define ODP_CUNICT_COMMON_H
#include <stdint.h>
+#include <inttypes.h>
#include "CUnit/Basic.h"
#include "CUnit/TestDB.h"
#include <odp_api.h>