From 4fa90f321f51af8f5bfc48eee1435e2f41d853b3 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 10 Jul 2019 01:33:02 -0400 Subject: [PATCH] lib: force user to include `` This patch makes all the library headers except `` refuse to be included directly. This will allow us to change how those headers are organized, and even remove some if needed (as long as we move the existing content to another existing header), because we know the user does not include specific headers. To do this, the main `` defines `__BT_IN_BABELTRACE_H`, and each specific header does: #ifndef __BT_IN_BABELTRACE_H # error "Please include instead." #endif at the beginning. Because each specific header has the guarantee that it is included from ``, they don't include ``: `` includes it, and clears the private status definitions itself at the end. Therefore this patch removes `undef-func-status.h`. Some parts of the project need to have access to the `__BT_FUNC_STATUS_*` definitions. To do that, they do: #define __BT_IN_BABELTRACE_H #include Because `` is now manually written and maintained, this patch removes `extras/gen-babeltrace-h.py` which we used to generate it from `include/Makefile.am`. Signed-off-by: Philippe Proulx Change-Id: Icc3bf0bec18a465024b316f02f84df7a75429b87 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1671 Tested-by: jenkins --- extras/gen-babeltrace-h.py | 105 ------------------ include/Makefile.am | 3 +- include/babeltrace2/babeltrace.h | 87 +++++++++++---- include/babeltrace2/current-thread.h | 11 +- include/babeltrace2/error-cause-const.h | 4 + include/babeltrace2/error-const.h | 4 + include/babeltrace2/func-status.h | 73 ++++++------ .../babeltrace2/graph/component-class-const.h | 4 + .../graph/component-class-filter-const.h | 4 + .../graph/component-class-filter.h | 4 + .../graph/component-class-sink-const.h | 4 + .../babeltrace2/graph/component-class-sink.h | 11 +- .../graph/component-class-source-const.h | 4 + .../graph/component-class-source.h | 4 + include/babeltrace2/graph/component-class.h | 11 +- include/babeltrace2/graph/component-const.h | 4 + .../graph/component-filter-const.h | 4 + .../babeltrace2/graph/component-sink-const.h | 4 + .../graph/component-source-const.h | 4 + include/babeltrace2/graph/connection-const.h | 4 + include/babeltrace2/graph/graph-const.h | 4 + include/babeltrace2/graph/graph.h | 11 +- include/babeltrace2/graph/message-const.h | 4 + .../graph/message-discarded-events-const.h | 4 + .../graph/message-discarded-events.h | 4 + .../graph/message-discarded-packets-const.h | 4 + .../graph/message-discarded-packets.h | 4 + .../babeltrace2/graph/message-event-const.h | 4 + include/babeltrace2/graph/message-event.h | 4 + include/babeltrace2/graph/message-iterator.h | 9 +- ...essage-message-iterator-inactivity-const.h | 4 + .../message-message-iterator-inactivity.h | 4 + .../graph/message-packet-beginning-const.h | 4 + .../graph/message-packet-beginning.h | 4 + .../graph/message-packet-end-const.h | 4 + .../babeltrace2/graph/message-packet-end.h | 4 + .../graph/message-stream-beginning-const.h | 4 + .../graph/message-stream-beginning.h | 4 + .../babeltrace2/graph/message-stream-const.h | 4 + .../graph/message-stream-end-const.h | 4 + .../babeltrace2/graph/message-stream-end.h | 4 + include/babeltrace2/graph/port-const.h | 4 + include/babeltrace2/graph/port-input-const.h | 4 + include/babeltrace2/graph/port-output-const.h | 4 + .../graph/port-output-message-iterator.h | 4 + .../babeltrace2/graph/query-executor-const.h | 4 + include/babeltrace2/graph/query-executor.h | 11 +- .../graph/self-component-class-filter.h | 4 + .../graph/self-component-class-sink.h | 4 + .../graph/self-component-class-source.h | 4 + .../babeltrace2/graph/self-component-filter.h | 4 + ...lf-component-port-input-message-iterator.h | 4 + .../graph/self-component-port-input.h | 4 + .../graph/self-component-port-output.h | 4 + .../babeltrace2/graph/self-component-port.h | 4 + .../babeltrace2/graph/self-component-sink.h | 4 + .../babeltrace2/graph/self-component-source.h | 4 + include/babeltrace2/graph/self-component.h | 11 +- .../babeltrace2/graph/self-message-iterator.h | 4 + include/babeltrace2/logging.h | 4 + include/babeltrace2/plugin/plugin-const.h | 11 +- include/babeltrace2/plugin/plugin-dev.h | 11 +- include/babeltrace2/plugin/plugin-set-const.h | 4 + include/babeltrace2/property.h | 4 + .../babeltrace2/trace-ir/clock-class-const.h | 11 +- include/babeltrace2/trace-ir/clock-class.h | 11 +- .../trace-ir/clock-snapshot-const.h | 11 +- .../babeltrace2/trace-ir/event-class-const.h | 4 + include/babeltrace2/trace-ir/event-class.h | 11 +- include/babeltrace2/trace-ir/event-const.h | 4 + include/babeltrace2/trace-ir/event.h | 4 + .../babeltrace2/trace-ir/field-class-const.h | 11 +- include/babeltrace2/trace-ir/field-class.h | 11 +- include/babeltrace2/trace-ir/field-const.h | 11 +- .../babeltrace2/trace-ir/field-path-const.h | 4 + include/babeltrace2/trace-ir/field.h | 11 +- include/babeltrace2/trace-ir/packet-const.h | 4 + .../trace-ir/packet-context-field.h | 4 + include/babeltrace2/trace-ir/packet.h | 11 +- .../babeltrace2/trace-ir/stream-class-const.h | 4 + include/babeltrace2/trace-ir/stream-class.h | 11 +- include/babeltrace2/trace-ir/stream-const.h | 4 + include/babeltrace2/trace-ir/stream.h | 11 +- .../babeltrace2/trace-ir/trace-class-const.h | 11 +- include/babeltrace2/trace-ir/trace-class.h | 11 +- include/babeltrace2/trace-ir/trace-const.h | 11 +- include/babeltrace2/trace-ir/trace.h | 11 +- include/babeltrace2/types.h | 4 + include/babeltrace2/undef-func-status.h | 39 ------- include/babeltrace2/util.h | 4 + include/babeltrace2/value-const.h | 11 +- include/babeltrace2/value.h | 11 +- include/babeltrace2/version.h | 4 + src/bindings/python/bt2/bt2/native_bt.i | 16 ++- src/common/common.h | 11 +- src/lib/babeltrace2.c | 3 +- src/lib/current-thread.c | 2 +- src/lib/error.c | 3 +- src/lib/error.h | 3 +- src/lib/func-status.h | 5 +- src/lib/lib-logging.c | 5 +- src/lib/logging.c | 3 +- src/lib/property.h | 3 +- src/lib/util.c | 2 +- src/lib/value.c | 5 +- src/lib/value.h | 7 +- src/logging/log.h | 3 +- src/plugins/comp-logging.h | 4 +- tests/ctf-writer/ctf_writer.c | 2 +- 109 files changed, 488 insertions(+), 428 deletions(-) delete mode 100644 extras/gen-babeltrace-h.py delete mode 100644 include/babeltrace2/undef-func-status.h diff --git a/extras/gen-babeltrace-h.py b/extras/gen-babeltrace-h.py deleted file mode 100644 index b83f262a..00000000 --- a/extras/gen-babeltrace-h.py +++ /dev/null @@ -1,105 +0,0 @@ -import re - - -class _Section: - def __init__(self, title, filenames): - self.title = title - self.filenames = filenames - - -def _get_sections(file): - sections = [] - cur_title = None - cur_filenames = [] - - for line in file: - m = re.match(r'^# (.+API.*)$', line) - - if m: - if cur_filenames: - sections.append(_Section(cur_title, cur_filenames)) - cur_title = None - cur_filenames = [] - - cur_title = m.group(1) - continue - - m = re.match(r'^\s+(babeltrace2/.+\.h).*$', line) - - if m: - if m.group(1) != 'babeltrace2/babeltrace.h': - cur_filenames.append(m.group(1)) - - continue - - if re.match(r'^noinst_HEADERS.*', line): - break - - if cur_filenames: - sections.append(_Section(cur_title, cur_filenames)) - - return sections - - -def _c_includes_from_sections(sections): - src = '' - - for section in sections: - # CTF writer is not part of the Babeltrace library - if 'ctf' in section.title.lower(): - continue - - src += '/* {} */\n'.format(section.title) - lines = [] - - for filename in sorted(section.filenames): - # not part of the API - if 'func-status' in filename: - continue - - lines.append('#include <{}>\n'.format(filename)) - - lines.sort() - src += ''.join(lines) - src += '\n' - - return src[:-1] - - -def _main(): - with open('include/Makefile.am') as f: - sections = _get_sections(f) - - print('''#ifndef BABELTRACE2_BABELTRACE_H -#define BABELTRACE2_BABELTRACE_H - -/* - * Babeltrace API - * - * Copyright 2010-2018 EfficiOS Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -''') - print(_c_includes_from_sections(sections)) - print('#endif /* BABELTRACE2_BABELTRACE_H */') - - -if __name__ == '__main__': - _main() diff --git a/include/Makefile.am b/include/Makefile.am index 95a3327e..72fa2761 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,14 +2,13 @@ babeltrace2includedir = "$(includedir)/babeltrace2" babeltrace2include_HEADERS = \ babeltrace2/babeltrace.h \ - babeltrace2/func-status.h \ babeltrace2/current-thread.h \ babeltrace2/error-cause-const.h \ babeltrace2/error-const.h \ + babeltrace2/func-status.h \ babeltrace2/logging.h \ babeltrace2/property.h \ babeltrace2/types.h \ - babeltrace2/undef-func-status.h \ babeltrace2/util.h \ babeltrace2/value-const.h \ babeltrace2/value.h \ diff --git a/include/babeltrace2/babeltrace.h b/include/babeltrace2/babeltrace.h index bd988688..11eab6b6 100644 --- a/include/babeltrace2/babeltrace.h +++ b/include/babeltrace2/babeltrace.h @@ -4,7 +4,7 @@ /* * Babeltrace API * - * Copyright 2010-2018 EfficiOS Inc. + * Copyright 2010-2019 EfficiOS Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,6 +25,18 @@ * SOFTWARE. */ +/* + * Tell the specific headers that they are included from this header. + * + * Do NOT define `__BT_IN_BABELTRACE_H` in user code. + */ +#ifndef __BT_IN_BABELTRACE_H +# define __BT_IN_BABELTRACE_H +#endif + +/* Need by some of the following included headers */ +#include + /* Core API */ #include #include @@ -62,12 +74,7 @@ #include #include -/* Plugin and plugin development API */ -#include -#include -#include - -/* Graph, component, and message API */ +/* Component class API */ #include #include #include @@ -76,13 +83,30 @@ #include #include #include +#include +#include +#include + +/* Component API */ #include #include #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +/* Message iterator API */ +#include +#include +#include +#include + +/* Message API */ #include #include #include @@ -90,7 +114,6 @@ #include #include #include -#include #include #include #include @@ -102,23 +125,39 @@ #include #include #include + +/* Graph API */ +#include +#include +#include #include #include #include -#include + +/* Query executor API */ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +/* Plugin API */ +#include +#include + +/* Plugin development */ +#include + +/* Cancel private definitions */ +#undef __BT_FUNC_STATUS_OVERFLOW +#undef __BT_FUNC_STATUS_INVALID_PARAMS +#undef __BT_FUNC_STATUS_INVALID_OBJECT +#undef __BT_FUNC_STATUS_MEMORY_ERROR +#undef __BT_FUNC_STATUS_LOADING_ERROR +#undef __BT_FUNC_STATUS_ERROR +#undef __BT_FUNC_STATUS_OK +#undef __BT_FUNC_STATUS_END +#undef __BT_FUNC_STATUS_NOT_FOUND +#undef __BT_FUNC_STATUS_AGAIN +#undef __BT_FUNC_STATUS_UNSUPPORTED +#undef __BT_FUNC_STATUS_CANCELED +#undef __BT_IN_BABELTRACE_H #endif /* BABELTRACE2_BABELTRACE_H */ diff --git a/include/babeltrace2/current-thread.h b/include/babeltrace2/current-thread.h index 65d32ec1..125db20e 100644 --- a/include/babeltrace2/current-thread.h +++ b/include/babeltrace2/current-thread.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* @@ -31,11 +35,6 @@ */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -98,6 +97,4 @@ bt_current_thread_error_append_cause_from_message_iterator( } #endif -#include - #endif /* BABELTRACE2_CURRENT_THREAD_H */ diff --git a/include/babeltrace2/error-cause-const.h b/include/babeltrace2/error-cause-const.h index 3fd1dfd3..8b4e36e0 100644 --- a/include/babeltrace2/error-cause-const.h +++ b/include/babeltrace2/error-cause-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include diff --git a/include/babeltrace2/error-const.h b/include/babeltrace2/error-const.h index 5ac971de..bee1b752 100644 --- a/include/babeltrace2/error-const.h +++ b/include/babeltrace2/error-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include diff --git a/include/babeltrace2/func-status.h b/include/babeltrace2/func-status.h index 60b68628..640cc98a 100644 --- a/include/babeltrace2/func-status.h +++ b/include/babeltrace2/func-status.h @@ -1,12 +1,6 @@ /* - * No include guards here: this header is included by a public header to - * get the `__BT_FUNC_STATUS_*` definitions locally, and then - * is included at the end of the - * header to undefine all those definitions. - * - * If we forget to include at the end - * of a public header, we want to get the "redefined" compiler warning - * to catch it. + * No include guards here: it is safe to include this file multiple + * times. */ /* @@ -31,19 +25,8 @@ * SOFTWARE. */ -/* - * This is just extra protection, in case the user tries to include - * in user code: this is a redminder that - * this header is reserved for internal use. - * - * The correct way for a public header to include this is: - * - * #define __BT_FUNC_STATUS_ENABLE - * #include - * #undef __BT_FUNC_STATUS_ENABLE - */ -#ifndef __BT_FUNC_STATUS_ENABLE -# error Do NOT include in user code. +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." #endif /* @@ -54,37 +37,61 @@ */ /* Value is too large for the given data type */ -#define __BT_FUNC_STATUS_OVERFLOW -75 +#ifndef __BT_FUNC_STATUS_OVERFLOW +# define __BT_FUNC_STATUS_OVERFLOW -75 +#endif /* Invalid query parameters */ -#define __BT_FUNC_STATUS_INVALID_PARAMS -24 +#ifndef __BT_FUNC_STATUS_INVALID_PARAMS +# define __BT_FUNC_STATUS_INVALID_PARAMS -24 +#endif /* Invalid query object */ -#define __BT_FUNC_STATUS_INVALID_OBJECT -23 +#ifndef __BT_FUNC_STATUS_INVALID_OBJECT +# define __BT_FUNC_STATUS_INVALID_OBJECT -23 +#endif /* Memory allocation error */ -#define __BT_FUNC_STATUS_MEMORY_ERROR -12 +#ifndef __BT_FUNC_STATUS_MEMORY_ERROR +# define __BT_FUNC_STATUS_MEMORY_ERROR -12 +#endif /* Plugin loading error */ -#define __BT_FUNC_STATUS_LOADING_ERROR -2 +#ifndef __BT_FUNC_STATUS_LOADING_ERROR +# define __BT_FUNC_STATUS_LOADING_ERROR -2 +#endif /* General error */ -#define __BT_FUNC_STATUS_ERROR -1 +#ifndef __BT_FUNC_STATUS_ERROR +# define __BT_FUNC_STATUS_ERROR -1 +#endif /* Saul Goodman */ -#define __BT_FUNC_STATUS_OK 0 +#ifndef __BT_FUNC_STATUS_OK +# define __BT_FUNC_STATUS_OK 0 +#endif /* End of iteration/consumption */ -#define __BT_FUNC_STATUS_END 1 +#ifndef __BT_FUNC_STATUS_END +# define __BT_FUNC_STATUS_END 1 +#endif /* Something can't be found */ -#define __BT_FUNC_STATUS_NOT_FOUND 2 +#ifndef __BT_FUNC_STATUS_NOT_FOUND +# define __BT_FUNC_STATUS_NOT_FOUND 2 +#endif /* Try operation again later */ -#define __BT_FUNC_STATUS_AGAIN 11 +#ifndef __BT_FUNC_STATUS_AGAIN +# define __BT_FUNC_STATUS_AGAIN 11 +#endif /* Unsupported operation */ -#define __BT_FUNC_STATUS_UNSUPPORTED 95 +#ifndef __BT_FUNC_STATUS_UNSUPPORTED +# define __BT_FUNC_STATUS_UNSUPPORTED 95 +#endif /* Object is canceled */ -#define __BT_FUNC_STATUS_CANCELED 125 +#ifndef __BT_FUNC_STATUS_CANCELED +# define __BT_FUNC_STATUS_CANCELED 125 +#endif diff --git a/include/babeltrace2/graph/component-class-const.h b/include/babeltrace2/graph/component-class-const.h index e68c572d..250b0762 100644 --- a/include/babeltrace2/graph/component-class-const.h +++ b/include/babeltrace2/graph/component-class-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_bool, bt_component_class */ #include diff --git a/include/babeltrace2/graph/component-class-filter-const.h b/include/babeltrace2/graph/component-class-filter-const.h index bfa27cbc..df867600 100644 --- a/include/babeltrace2/graph/component-class-filter-const.h +++ b/include/babeltrace2/graph/component-class-filter-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_component_class, bt_component_class_filter, * __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/component-class-filter.h b/include/babeltrace2/graph/component-class-filter.h index 44ce7339..3616b01a 100644 --- a/include/babeltrace2/graph/component-class-filter.h +++ b/include/babeltrace2/graph/component-class-filter.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_component_class_*_status */ diff --git a/include/babeltrace2/graph/component-class-sink-const.h b/include/babeltrace2/graph/component-class-sink-const.h index 5fba26ec..d4833fbc 100644 --- a/include/babeltrace2/graph/component-class-sink-const.h +++ b/include/babeltrace2/graph/component-class-sink-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_component_class, bt_component_class_sink, __BT_UPCAST_CONST */ #include diff --git a/include/babeltrace2/graph/component-class-sink.h b/include/babeltrace2/graph/component-class-sink.h index 80ee66c8..48d647f5 100644 --- a/include/babeltrace2/graph/component-class-sink.h +++ b/include/babeltrace2/graph/component-class-sink.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_component_class_*_status */ @@ -40,11 +44,6 @@ /* For bt_logging_level */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -139,6 +138,4 @@ bt_component_class_sink_set_query_method( } #endif -#include - #endif /* BABELTRACE2_GRAPH_COMPONENT_CLASS_SINK_H */ diff --git a/include/babeltrace2/graph/component-class-source-const.h b/include/babeltrace2/graph/component-class-source-const.h index 0b347bda..42181ce6 100644 --- a/include/babeltrace2/graph/component-class-source-const.h +++ b/include/babeltrace2/graph/component-class-source-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_component_class, bt_component_class_source, * __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/component-class-source.h b/include/babeltrace2/graph/component-class-source.h index 1bd9e4d2..3aa89cef 100644 --- a/include/babeltrace2/graph/component-class-source.h +++ b/include/babeltrace2/graph/component-class-source.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_component_class_*_status */ diff --git a/include/babeltrace2/graph/component-class.h b/include/babeltrace2/graph/component-class.h index bd399f3a..b666ba93 100644 --- a/include/babeltrace2/graph/component-class.h +++ b/include/babeltrace2/graph/component-class.h @@ -24,14 +24,13 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_component_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -111,6 +110,4 @@ extern bt_component_class_set_help_status bt_component_class_set_help( } #endif -#include - #endif /* BABELTRACE2_GRAPH_COMPONENT_CLASS_H */ diff --git a/include/babeltrace2/graph/component-const.h b/include/babeltrace2/graph/component-const.h index a504a760..aa9f84ce 100644 --- a/include/babeltrace2/graph/component-const.h +++ b/include/babeltrace2/graph/component-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_component_class_type */ #include diff --git a/include/babeltrace2/graph/component-filter-const.h b/include/babeltrace2/graph/component-filter-const.h index 098db72a..27011951 100644 --- a/include/babeltrace2/graph/component-filter-const.h +++ b/include/babeltrace2/graph/component-filter-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* diff --git a/include/babeltrace2/graph/component-sink-const.h b/include/babeltrace2/graph/component-sink-const.h index a5505673..d6a39254 100644 --- a/include/babeltrace2/graph/component-sink-const.h +++ b/include/babeltrace2/graph/component-sink-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* diff --git a/include/babeltrace2/graph/component-source-const.h b/include/babeltrace2/graph/component-source-const.h index 2e0bacfd..c0f4e926 100644 --- a/include/babeltrace2/graph/component-source-const.h +++ b/include/babeltrace2/graph/component-source-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* diff --git a/include/babeltrace2/graph/connection-const.h b/include/babeltrace2/graph/connection-const.h index 38ce7922..9f1f2a87 100644 --- a/include/babeltrace2/graph/connection-const.h +++ b/include/babeltrace2/graph/connection-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_bool, bt_port_input, bt_port_output, bt_connection */ #include diff --git a/include/babeltrace2/graph/graph-const.h b/include/babeltrace2/graph/graph-const.h index ae544a3c..8fd9a5d6 100644 --- a/include/babeltrace2/graph/graph-const.h +++ b/include/babeltrace2/graph/graph-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_bool, bt_graph */ #include diff --git a/include/babeltrace2/graph/graph.h b/include/babeltrace2/graph/graph.h index 4b1909e8..4e85e427 100644 --- a/include/babeltrace2/graph/graph.h +++ b/include/babeltrace2/graph/graph.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_bool, bt_component, bt_component_class, * bt_component_class_filter, bt_component_class_sink, @@ -36,11 +40,6 @@ /* For bt_logging_level */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -258,6 +257,4 @@ extern bt_graph_cancel_status bt_graph_cancel(bt_graph *graph); } #endif -#include - #endif /* BABELTRACE2_GRAPH_GRAPH_H */ diff --git a/include/babeltrace2/graph/message-const.h b/include/babeltrace2/graph/message-const.h index bb3de18e..cd3efe40 100644 --- a/include/babeltrace2/graph/message-const.h +++ b/include/babeltrace2/graph/message-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message */ #include diff --git a/include/babeltrace2/graph/message-discarded-events-const.h b/include/babeltrace2/graph/message-discarded-events-const.h index 64076067..4f7da252 100644 --- a/include/babeltrace2/graph/message-discarded-events-const.h +++ b/include/babeltrace2/graph/message-discarded-events-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_clock_snapshot, bt_stream */ #include diff --git a/include/babeltrace2/graph/message-discarded-events.h b/include/babeltrace2/graph/message-discarded-events.h index 5b3cb7a5..b2b97d6f 100644 --- a/include/babeltrace2/graph/message-discarded-events.h +++ b/include/babeltrace2/graph/message-discarded-events.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message, bt_self_message_iterator, bt_stream */ diff --git a/include/babeltrace2/graph/message-discarded-packets-const.h b/include/babeltrace2/graph/message-discarded-packets-const.h index ea02fbaa..6bfee12e 100644 --- a/include/babeltrace2/graph/message-discarded-packets-const.h +++ b/include/babeltrace2/graph/message-discarded-packets-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_clock_snapshot, bt_stream */ #include diff --git a/include/babeltrace2/graph/message-discarded-packets.h b/include/babeltrace2/graph/message-discarded-packets.h index 3c2f22d8..bc1896b1 100644 --- a/include/babeltrace2/graph/message-discarded-packets.h +++ b/include/babeltrace2/graph/message-discarded-packets.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message, bt_self_message_iterator, bt_stream */ diff --git a/include/babeltrace2/graph/message-event-const.h b/include/babeltrace2/graph/message-event-const.h index c8cd6104..933582af 100644 --- a/include/babeltrace2/graph/message-event-const.h +++ b/include/babeltrace2/graph/message-event-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_bool, bt_message, bt_event. bt_clock_class, bt_clock_snapshot */ #include diff --git a/include/babeltrace2/graph/message-event.h b/include/babeltrace2/graph/message-event.h index dbf8a6fe..c7f48e08 100644 --- a/include/babeltrace2/graph/message-event.h +++ b/include/babeltrace2/graph/message-event.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* diff --git a/include/babeltrace2/graph/message-iterator.h b/include/babeltrace2/graph/message-iterator.h index 70747959..bfe9ae49 100644 --- a/include/babeltrace2/graph/message-iterator.h +++ b/include/babeltrace2/graph/message-iterator.h @@ -24,10 +24,9 @@ * SOFTWARE. */ -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif #ifdef __cplusplus extern "C" { @@ -61,6 +60,4 @@ typedef enum bt_message_iterator_seek_ns_from_origin_status { } #endif -#include - #endif /* BABELTRACE2_GRAPH_MESSAGE_ITERATOR_H */ diff --git a/include/babeltrace2/graph/message-message-iterator-inactivity-const.h b/include/babeltrace2/graph/message-message-iterator-inactivity-const.h index b1df4d13..ceeb7f86 100644 --- a/include/babeltrace2/graph/message-message-iterator-inactivity-const.h +++ b/include/babeltrace2/graph/message-message-iterator-inactivity-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_clock_snapshot */ #include diff --git a/include/babeltrace2/graph/message-message-iterator-inactivity.h b/include/babeltrace2/graph/message-message-iterator-inactivity.h index a2deac66..c738a6e9 100644 --- a/include/babeltrace2/graph/message-message-iterator-inactivity.h +++ b/include/babeltrace2/graph/message-message-iterator-inactivity.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_self_message_iterator, bt_message, bt_clock_class */ diff --git a/include/babeltrace2/graph/message-packet-beginning-const.h b/include/babeltrace2/graph/message-packet-beginning-const.h index e65857ce..f0e2a0dd 100644 --- a/include/babeltrace2/graph/message-packet-beginning-const.h +++ b/include/babeltrace2/graph/message-packet-beginning-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_packet, bt_clock_snapshot, bt_clock_class */ #include diff --git a/include/babeltrace2/graph/message-packet-beginning.h b/include/babeltrace2/graph/message-packet-beginning.h index 20eed9c0..a6942469 100644 --- a/include/babeltrace2/graph/message-packet-beginning.h +++ b/include/babeltrace2/graph/message-packet-beginning.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message, bt_self_message_iterator, bt_packet */ diff --git a/include/babeltrace2/graph/message-packet-end-const.h b/include/babeltrace2/graph/message-packet-end-const.h index d9ca9085..feb857c3 100644 --- a/include/babeltrace2/graph/message-packet-end-const.h +++ b/include/babeltrace2/graph/message-packet-end-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_packet, bt_clock_snapshot, bt_clock_class */ #include diff --git a/include/babeltrace2/graph/message-packet-end.h b/include/babeltrace2/graph/message-packet-end.h index 424c3070..5eb25e7b 100644 --- a/include/babeltrace2/graph/message-packet-end.h +++ b/include/babeltrace2/graph/message-packet-end.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message, bt_self_message_iterator, bt_packet */ diff --git a/include/babeltrace2/graph/message-stream-beginning-const.h b/include/babeltrace2/graph/message-stream-beginning-const.h index 22e3d511..95b58f07 100644 --- a/include/babeltrace2/graph/message-stream-beginning-const.h +++ b/include/babeltrace2/graph/message-stream-beginning-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_clock_snapshot, bt_stream */ #include diff --git a/include/babeltrace2/graph/message-stream-beginning.h b/include/babeltrace2/graph/message-stream-beginning.h index 95f0e008..b798a654 100644 --- a/include/babeltrace2/graph/message-stream-beginning.h +++ b/include/babeltrace2/graph/message-stream-beginning.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_self_message_iterator, bt_stream */ #include diff --git a/include/babeltrace2/graph/message-stream-const.h b/include/babeltrace2/graph/message-stream-const.h index 2c42ed9e..50592bcd 100644 --- a/include/babeltrace2/graph/message-stream-const.h +++ b/include/babeltrace2/graph/message-stream-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/include/babeltrace2/graph/message-stream-end-const.h b/include/babeltrace2/graph/message-stream-end-const.h index 1da44c96..b7bccc7d 100644 --- a/include/babeltrace2/graph/message-stream-end-const.h +++ b/include/babeltrace2/graph/message-stream-end-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_clock_snapshot, bt_stream */ #include diff --git a/include/babeltrace2/graph/message-stream-end.h b/include/babeltrace2/graph/message-stream-end.h index 6f3f36b3..948c53f5 100644 --- a/include/babeltrace2/graph/message-stream-end.h +++ b/include/babeltrace2/graph/message-stream-end.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_message, bt_self_message_iterator, bt_stream */ #include diff --git a/include/babeltrace2/graph/port-const.h b/include/babeltrace2/graph/port-const.h index a6436a5d..3ed54426 100644 --- a/include/babeltrace2/graph/port-const.h +++ b/include/babeltrace2/graph/port-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_bool, bt_port, bt_connection, bt_component */ diff --git a/include/babeltrace2/graph/port-input-const.h b/include/babeltrace2/graph/port-input-const.h index c0882f7a..a1b32ece 100644 --- a/include/babeltrace2/graph/port-input-const.h +++ b/include/babeltrace2/graph/port-input-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_port, bt_port_input, __BT_UPCAST_CONST */ #include diff --git a/include/babeltrace2/graph/port-output-const.h b/include/babeltrace2/graph/port-output-const.h index 9ebcb444..b923691a 100644 --- a/include/babeltrace2/graph/port-output-const.h +++ b/include/babeltrace2/graph/port-output-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_port, bt_port_output, __BT_UPCAST_CONST */ #include diff --git a/include/babeltrace2/graph/port-output-message-iterator.h b/include/babeltrace2/graph/port-output-message-iterator.h index d49839fb..04bed3dc 100644 --- a/include/babeltrace2/graph/port-output-message-iterator.h +++ b/include/babeltrace2/graph/port-output-message-iterator.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message_iterator_*_status */ diff --git a/include/babeltrace2/graph/query-executor-const.h b/include/babeltrace2/graph/query-executor-const.h index 59ac13c1..6fa6f332 100644 --- a/include/babeltrace2/graph/query-executor-const.h +++ b/include/babeltrace2/graph/query-executor-const.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_bool, bt_query_executor */ #include diff --git a/include/babeltrace2/graph/query-executor.h b/include/babeltrace2/graph/query-executor.h index c6a84101..2992cb47 100644 --- a/include/babeltrace2/graph/query-executor.h +++ b/include/babeltrace2/graph/query-executor.h @@ -23,17 +23,16 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_query_executor, bt_component_class, bt_value */ #include /* For bt_logging_level */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -71,6 +70,4 @@ bt_query_executor_cancel_status bt_query_executor_cancel( } #endif -#include - #endif /* BABELTRACE2_GRAPH_QUERY_EXECUTOR_H */ diff --git a/include/babeltrace2/graph/self-component-class-filter.h b/include/babeltrace2/graph/self-component-class-filter.h index 83045f70..f901c7ab 100644 --- a/include/babeltrace2/graph/self-component-class-filter.h +++ b/include/babeltrace2/graph/self-component-class-filter.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_component_class_filter, bt_self_component_class_filter, * __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-class-sink.h b/include/babeltrace2/graph/self-component-class-sink.h index e06c6b6f..ec116f47 100644 --- a/include/babeltrace2/graph/self-component-class-sink.h +++ b/include/babeltrace2/graph/self-component-class-sink.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_component_class_sink, bt_self_component_class_sink, * __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-class-source.h b/include/babeltrace2/graph/self-component-class-source.h index a083546f..6d4dd082 100644 --- a/include/babeltrace2/graph/self-component-class-source.h +++ b/include/babeltrace2/graph/self-component-class-source.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_component_class_source, bt_self_component_class_source, * __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-filter.h b/include/babeltrace2/graph/self-component-filter.h index 20b3e9f8..2d07f31f 100644 --- a/include/babeltrace2/graph/self-component-filter.h +++ b/include/babeltrace2/graph/self-component-filter.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_self_component_*_status */ diff --git a/include/babeltrace2/graph/self-component-port-input-message-iterator.h b/include/babeltrace2/graph/self-component-port-input-message-iterator.h index 22f70876..d53353b7 100644 --- a/include/babeltrace2/graph/self-component-port-input-message-iterator.h +++ b/include/babeltrace2/graph/self-component-port-input-message-iterator.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_message_iterator_*_status */ diff --git a/include/babeltrace2/graph/self-component-port-input.h b/include/babeltrace2/graph/self-component-port-input.h index 094f3f3e..29bde50d 100644 --- a/include/babeltrace2/graph/self-component-port-input.h +++ b/include/babeltrace2/graph/self-component-port-input.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_port_input, bt_self_component_port, * bt_self_component_port_input, __BT_UPCAST, __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-port-output.h b/include/babeltrace2/graph/self-component-port-output.h index 62adf8dd..8e13d7d1 100644 --- a/include/babeltrace2/graph/self-component-port-output.h +++ b/include/babeltrace2/graph/self-component-port-output.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_port_output, bt_self_component_port, * bt_self_component_port_output, __BT_UPCAST, __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-port.h b/include/babeltrace2/graph/self-component-port.h index c788523a..bd93753d 100644 --- a/include/babeltrace2/graph/self-component-port.h +++ b/include/babeltrace2/graph/self-component-port.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_port, bt_self_component_port, bt_self_component, * bt_connection, __BT_UPCAST_CONST diff --git a/include/babeltrace2/graph/self-component-sink.h b/include/babeltrace2/graph/self-component-sink.h index a55fba75..ed9c307e 100644 --- a/include/babeltrace2/graph/self-component-sink.h +++ b/include/babeltrace2/graph/self-component-sink.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_self_component_*_status */ diff --git a/include/babeltrace2/graph/self-component-source.h b/include/babeltrace2/graph/self-component-source.h index abd0f85c..6dac6f64 100644 --- a/include/babeltrace2/graph/self-component-source.h +++ b/include/babeltrace2/graph/self-component-source.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_self_component_*_status */ diff --git a/include/babeltrace2/graph/self-component.h b/include/babeltrace2/graph/self-component.h index a63312c4..f0b02ee8 100644 --- a/include/babeltrace2/graph/self-component.h +++ b/include/babeltrace2/graph/self-component.h @@ -23,14 +23,13 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_component, bt_self_component, __BT_UPCAST */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -58,6 +57,4 @@ extern void bt_self_component_set_data( } #endif -#include - #endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_H */ diff --git a/include/babeltrace2/graph/self-message-iterator.h b/include/babeltrace2/graph/self-message-iterator.h index d33ca4e7..155542b8 100644 --- a/include/babeltrace2/graph/self-message-iterator.h +++ b/include/babeltrace2/graph/self-message-iterator.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_self_component, bt_self_message_iterator, bt_self_port_output */ #include diff --git a/include/babeltrace2/logging.h b/include/babeltrace2/logging.h index 5e5bc3c5..ea6eadab 100644 --- a/include/babeltrace2/logging.h +++ b/include/babeltrace2/logging.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include #include diff --git a/include/babeltrace2/plugin/plugin-const.h b/include/babeltrace2/plugin/plugin-const.h index 034fb543..df82ddc0 100644 --- a/include/babeltrace2/plugin/plugin-const.h +++ b/include/babeltrace2/plugin/plugin-const.h @@ -26,6 +26,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include @@ -39,11 +43,6 @@ /* For bt_property_availability */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -162,6 +161,4 @@ extern void bt_plugin_put_ref(const bt_plugin *plugin); } #endif -#include - #endif /* BABELTRACE2_PLUGIN_PLUGIN_CONST_H */ diff --git a/include/babeltrace2/plugin/plugin-dev.h b/include/babeltrace2/plugin/plugin-dev.h index b50a6cc1..e2b03be0 100644 --- a/include/babeltrace2/plugin/plugin-dev.h +++ b/include/babeltrace2/plugin/plugin-dev.h @@ -27,6 +27,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_component_class_type */ @@ -40,11 +44,6 @@ /* For bt_self_plugin */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - /* * _BT_HIDDEN: set the hidden attribute for internal functions * On Windows, symbols are local unless explicitly exported, @@ -1479,6 +1478,4 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ } #endif -#include - #endif /* BABELTRACE2_PLUGIN_PLUGIN_DEV_H */ diff --git a/include/babeltrace2/plugin/plugin-set-const.h b/include/babeltrace2/plugin/plugin-set-const.h index e02bd0c2..6e68b30f 100644 --- a/include/babeltrace2/plugin/plugin-set-const.h +++ b/include/babeltrace2/plugin/plugin-set-const.h @@ -24,6 +24,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_plugin, bt_plugin_set */ diff --git a/include/babeltrace2/property.h b/include/babeltrace2/property.h index 91d088a7..3e62455b 100644 --- a/include/babeltrace2/property.h +++ b/include/babeltrace2/property.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/include/babeltrace2/trace-ir/clock-class-const.h b/include/babeltrace2/trace-ir/clock-class-const.h index c5a303df..efc27060 100644 --- a/include/babeltrace2/trace-ir/clock-class-const.h +++ b/include/babeltrace2/trace-ir/clock-class-const.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_bool, bt_uuid, bt_clock_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -93,6 +92,4 @@ extern void bt_clock_class_put_ref(const bt_clock_class *clock_class); } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_CLOCK_CLASS_CONST_H */ diff --git a/include/babeltrace2/trace-ir/clock-class.h b/include/babeltrace2/trace-ir/clock-class.h index 6cfecbae..556366f0 100644 --- a/include/babeltrace2/trace-ir/clock-class.h +++ b/include/babeltrace2/trace-ir/clock-class.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_bool, bt_uuid, bt_clock_class, bt_trace_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -78,6 +77,4 @@ extern void bt_clock_class_set_uuid(bt_clock_class *clock_class, } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_CLOCK_CLASS_H */ diff --git a/include/babeltrace2/trace-ir/clock-snapshot-const.h b/include/babeltrace2/trace-ir/clock-snapshot-const.h index 00a47d69..e0d87b92 100644 --- a/include/babeltrace2/trace-ir/clock-snapshot-const.h +++ b/include/babeltrace2/trace-ir/clock-snapshot-const.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_clock_class, bt_clock_snapshot */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -61,6 +60,4 @@ bt_clock_snapshot_get_ns_from_origin( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_CLOCK_SNAPSHOT_CONST_H */ diff --git a/include/babeltrace2/trace-ir/event-class-const.h b/include/babeltrace2/trace-ir/event-class-const.h index dde7c923..23c8acd1 100644 --- a/include/babeltrace2/trace-ir/event-class-const.h +++ b/include/babeltrace2/trace-ir/event-class-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_property_availability */ #include diff --git a/include/babeltrace2/trace-ir/event-class.h b/include/babeltrace2/trace-ir/event-class.h index ca6ad268..9b67e943 100644 --- a/include/babeltrace2/trace-ir/event-class.h +++ b/include/babeltrace2/trace-ir/event-class.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_event_class_log_level */ @@ -35,11 +39,6 @@ /* For bt_event_class, bt_stream_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -96,6 +95,4 @@ extern bt_field_class *bt_event_class_borrow_payload_field_class( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_EVENT_CLASS_H */ diff --git a/include/babeltrace2/trace-ir/event-const.h b/include/babeltrace2/trace-ir/event-const.h index c762b6b2..ff8c0710 100644 --- a/include/babeltrace2/trace-ir/event-const.h +++ b/include/babeltrace2/trace-ir/event-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_event, bt_event_class, bt_field, bt_packet */ #include diff --git a/include/babeltrace2/trace-ir/event.h b/include/babeltrace2/trace-ir/event.h index 57c5251a..00fe64a2 100644 --- a/include/babeltrace2/trace-ir/event.h +++ b/include/babeltrace2/trace-ir/event.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_event, bt_event_class, bt_field, bt_packet */ #include diff --git a/include/babeltrace2/trace-ir/field-class-const.h b/include/babeltrace2/trace-ir/field-class-const.h index 1dd49f0a..5a8b2b49 100644 --- a/include/babeltrace2/trace-ir/field-class-const.h +++ b/include/babeltrace2/trace-ir/field-class-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* * For bt_bool, bt_field_class, bt_field_path, * bt_field_class_enumeration_mapping, @@ -39,11 +43,6 @@ #include #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -214,6 +213,4 @@ extern void bt_field_class_put_ref(const bt_field_class *field_class); } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_CONST_H */ diff --git a/include/babeltrace2/trace-ir/field-class.h b/include/babeltrace2/trace-ir/field-class.h index d6997db5..f66fbb44 100644 --- a/include/babeltrace2/trace-ir/field-class.h +++ b/include/babeltrace2/trace-ir/field-class.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include @@ -36,11 +40,6 @@ /* For bt_field_class_integer_preferred_display_base */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -167,6 +166,4 @@ extern bt_field_class *bt_field_class_variant_option_borrow_field_class( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */ diff --git a/include/babeltrace2/trace-ir/field-const.h b/include/babeltrace2/trace-ir/field-const.h index f7257909..c2e39fd3 100644 --- a/include/babeltrace2/trace-ir/field-const.h +++ b/include/babeltrace2/trace-ir/field-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_field_class_type */ @@ -35,11 +39,6 @@ /* For bt_field, bt_field_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -101,6 +100,4 @@ bt_field_variant_borrow_selected_option_field_const( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_FIELD_CONST_H */ diff --git a/include/babeltrace2/trace-ir/field-path-const.h b/include/babeltrace2/trace-ir/field-path-const.h index e1c24164..286450fe 100644 --- a/include/babeltrace2/trace-ir/field-path-const.h +++ b/include/babeltrace2/trace-ir/field-path-const.h @@ -26,6 +26,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_field_path, bt_field_path_item */ diff --git a/include/babeltrace2/trace-ir/field.h b/include/babeltrace2/trace-ir/field.h index 1b80cdfb..4910927f 100644 --- a/include/babeltrace2/trace-ir/field.h +++ b/include/babeltrace2/trace-ir/field.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_field, bt_field_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -103,6 +102,4 @@ extern bt_field *bt_field_variant_borrow_selected_option_field( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_FIELD_H */ diff --git a/include/babeltrace2/trace-ir/packet-const.h b/include/babeltrace2/trace-ir/packet-const.h index 1272f99b..5390a165 100644 --- a/include/babeltrace2/trace-ir/packet-const.h +++ b/include/babeltrace2/trace-ir/packet-const.h @@ -26,6 +26,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_property_availability */ diff --git a/include/babeltrace2/trace-ir/packet-context-field.h b/include/babeltrace2/trace-ir/packet-context-field.h index 255c0309..376373e6 100644 --- a/include/babeltrace2/trace-ir/packet-context-field.h +++ b/include/babeltrace2/trace-ir/packet-context-field.h @@ -26,6 +26,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_stream_class, bt_packet_context_field, bt_field */ #include diff --git a/include/babeltrace2/trace-ir/packet.h b/include/babeltrace2/trace-ir/packet.h index 3ef1ecb6..bc45a4eb 100644 --- a/include/babeltrace2/trace-ir/packet.h +++ b/include/babeltrace2/trace-ir/packet.h @@ -26,16 +26,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_packet, bt_packet_context_field, bt_stream */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -59,6 +58,4 @@ bt_packet_move_context_field_status bt_packet_move_context_field( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_PACKET_H */ diff --git a/include/babeltrace2/trace-ir/stream-class-const.h b/include/babeltrace2/trace-ir/stream-class-const.h index 3e869e6b..d8233830 100644 --- a/include/babeltrace2/trace-ir/stream-class-const.h +++ b/include/babeltrace2/trace-ir/stream-class-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* diff --git a/include/babeltrace2/trace-ir/stream-class.h b/include/babeltrace2/trace-ir/stream-class.h index 15457cfc..48d50637 100644 --- a/include/babeltrace2/trace-ir/stream-class.h +++ b/include/babeltrace2/trace-ir/stream-class.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* @@ -35,11 +39,6 @@ */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -129,6 +128,4 @@ bt_stream_class_set_default_clock_class( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_STREAM_CLASS_H */ diff --git a/include/babeltrace2/trace-ir/stream-const.h b/include/babeltrace2/trace-ir/stream-const.h index 73786d4f..61da523d 100644 --- a/include/babeltrace2/trace-ir/stream-const.h +++ b/include/babeltrace2/trace-ir/stream-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + /* For bt_trace, bt_stream, bt_stream_class */ #include diff --git a/include/babeltrace2/trace-ir/stream.h b/include/babeltrace2/trace-ir/stream.h index 614b4b8f..8006dc59 100644 --- a/include/babeltrace2/trace-ir/stream.h +++ b/include/babeltrace2/trace-ir/stream.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_trace, bt_stream, bt_stream_class */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -64,6 +63,4 @@ extern bt_stream_set_name_status bt_stream_set_name(bt_stream *stream, } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_STREAM_H */ diff --git a/include/babeltrace2/trace-ir/trace-class-const.h b/include/babeltrace2/trace-ir/trace-class-const.h index 96b9ba37..ca75bee4 100644 --- a/include/babeltrace2/trace-ir/trace-class-const.h +++ b/include/babeltrace2/trace-ir/trace-class-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* @@ -35,11 +39,6 @@ */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -101,6 +100,4 @@ extern void bt_trace_class_put_ref(const bt_trace_class *trace_class); } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_TRACE_CLASS_CONST_H */ diff --git a/include/babeltrace2/trace-ir/trace-class.h b/include/babeltrace2/trace-ir/trace-class.h index 2fa94aca..52a87bab 100644 --- a/include/babeltrace2/trace-ir/trace-class.h +++ b/include/babeltrace2/trace-ir/trace-class.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_bool, bt_trace_class, bt_stream_class, bt_self_component */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -56,6 +55,4 @@ extern bt_stream_class *bt_trace_class_borrow_stream_class_by_id( } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_TRACE_CLASS_H */ diff --git a/include/babeltrace2/trace-ir/trace-const.h b/include/babeltrace2/trace-ir/trace-const.h index 9662810a..db06dcba 100644 --- a/include/babeltrace2/trace-ir/trace-const.h +++ b/include/babeltrace2/trace-ir/trace-const.h @@ -27,6 +27,10 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* @@ -35,11 +39,6 @@ */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -110,6 +109,4 @@ extern void bt_trace_put_ref(const bt_trace *trace); } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_TRACE_CONST_H */ diff --git a/include/babeltrace2/trace-ir/trace.h b/include/babeltrace2/trace-ir/trace.h index fcbf43f0..0e088721 100644 --- a/include/babeltrace2/trace-ir/trace.h +++ b/include/babeltrace2/trace-ir/trace.h @@ -27,16 +27,15 @@ * http://www.efficios.com/ctf */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* For bt_bool, bt_uuid, bt_trace, bt_trace_class, bt_stream */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -78,6 +77,4 @@ extern bt_stream *bt_trace_borrow_stream_by_id(bt_trace *trace, } #endif -#include - #endif /* BABELTRACE2_TRACE_IR_TRACE_H */ diff --git a/include/babeltrace2/types.h b/include/babeltrace2/types.h index f49c652c..a8a8bb48 100644 --- a/include/babeltrace2/types.h +++ b/include/babeltrace2/types.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include /* Internal use */ diff --git a/include/babeltrace2/undef-func-status.h b/include/babeltrace2/undef-func-status.h deleted file mode 100644 index efe6378d..00000000 --- a/include/babeltrace2/undef-func-status.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef BABELTRACE2_UNDEF_FUNC_STATUS_H -#define BABELTRACE2_UNDEF_FUNC_STATUS_H - -/* - * Copyright (c) 2019 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#undef __BT_FUNC_STATUS_OVERFLOW -#undef __BT_FUNC_STATUS_INVALID_PARAMS -#undef __BT_FUNC_STATUS_INVALID_OBJECT -#undef __BT_FUNC_STATUS_MEMORY_ERROR -#undef __BT_FUNC_STATUS_LOADING_ERROR -#undef __BT_FUNC_STATUS_ERROR -#undef __BT_FUNC_STATUS_OK -#undef __BT_FUNC_STATUS_END -#undef __BT_FUNC_STATUS_NOT_FOUND -#undef __BT_FUNC_STATUS_AGAIN -#undef __BT_FUNC_STATUS_UNSUPPORTED -#undef __BT_FUNC_STATUS_CANCELED - -#endif /* BABELTRACE2_UNDEF_FUNC_STATUS_H */ diff --git a/include/babeltrace2/util.h b/include/babeltrace2/util.h index 515047c1..d8878545 100644 --- a/include/babeltrace2/util.h +++ b/include/babeltrace2/util.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #ifdef __cplusplus diff --git a/include/babeltrace2/value-const.h b/include/babeltrace2/value-const.h index 536b6443..f443a755 100644 --- a/include/babeltrace2/value-const.h +++ b/include/babeltrace2/value-const.h @@ -23,17 +23,16 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include /* For bt_bool, bt_value */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -204,6 +203,4 @@ extern void bt_value_put_ref(const bt_value *value); } #endif -#include - #endif /* BABELTRACE2_VALUE_CONST_H */ diff --git a/include/babeltrace2/value.h b/include/babeltrace2/value.h index b6a22562..87190173 100644 --- a/include/babeltrace2/value.h +++ b/include/babeltrace2/value.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #include #include @@ -32,11 +36,6 @@ /* For bt_value_type */ #include -/* For __BT_FUNC_STATUS_* */ -#define __BT_FUNC_STATUS_ENABLE -#include -#undef __BT_FUNC_STATUS_ENABLE - #ifdef __cplusplus extern "C" { #endif @@ -177,6 +176,4 @@ bt_value_map_insert_empty_map_entry(bt_value *map_obj, const char *key); } #endif -#include - #endif /* BABELTRACE2_VALUE_H */ diff --git a/include/babeltrace2/version.h b/include/babeltrace2/version.h index 7138e94e..d1677319 100644 --- a/include/babeltrace2/version.h +++ b/include/babeltrace2/version.h @@ -23,6 +23,10 @@ * SOFTWARE. */ +#ifndef __BT_IN_BABELTRACE_H +# error "Please include instead." +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/src/bindings/python/bt2/bt2/native_bt.i b/src/bindings/python/bt2/bt2/native_bt.i index f9fb4512..c87a5e72 100644 --- a/src/bindings/python/bt2/bt2/native_bt.i +++ b/src/bindings/python/bt2/bt2/native_bt.i @@ -32,15 +32,19 @@ #define BT_LOG_TAG "BT2-PY" #include "logging.h" +/* + * Include before `` because + * `` removes the `__BT_IN_BABELTRACE_H` + * definition. + */ #include /* * This is not part of the API, but because those bindings reside within * the project, we take the liberty to use them. */ -#define __BT_FUNC_STATUS_ENABLE +#define __BT_IN_BABELTRACE_H #include -#undef __BT_FUNC_STATUS_ENABLE #include "common/assert.h" #include "py-common/py-common.h" @@ -180,11 +184,17 @@ typedef int bt_bool; $result = $1; } +/* + * Define `__BT_IN_BABELTRACE_H` to allow specific headers to be + * included. This remains defined as long as we don't include the main + * header, ``. + */ +#define __BT_IN_BABELTRACE_H + /* Property enumeration */ %include /* Common function status codes */ -#define __BT_FUNC_STATUS_ENABLE %include /* Per-module interface files */ diff --git a/src/common/common.h b/src/common/common.h index ca1b1399..0fdad32f 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -33,15 +33,10 @@ #include #include -#include -#include -#include -#include -#include +#include -#define __BT_FUNC_STATUS_ENABLE +#define __BT_IN_BABELTRACE_H #include -#undef __BT_FUNC_STATUS_ENABLE #include "common/assert.h" #include "common/macros.h" @@ -721,6 +716,4 @@ end: return ret; } -#include - #endif /* BABELTRACE_COMMON_INTERNAL_H */ diff --git a/src/lib/babeltrace2.c b/src/lib/babeltrace2.c index 4a74214a..abb71f35 100644 --- a/src/lib/babeltrace2.c +++ b/src/lib/babeltrace2.c @@ -22,8 +22,7 @@ * SOFTWARE. */ -#include -#include +#include #include int bt_version_get_major(void) diff --git a/src/lib/current-thread.c b/src/lib/current-thread.c index 519507de..743d6aa7 100644 --- a/src/lib/current-thread.c +++ b/src/lib/current-thread.c @@ -23,7 +23,7 @@ #define BT_LOG_TAG "LIB/CUR-THREAD" #include "lib/logging.h" -#include +#include #include #include diff --git a/src/lib/error.c b/src/lib/error.c index bb2c3ad6..f54b65f3 100644 --- a/src/lib/error.c +++ b/src/lib/error.c @@ -25,8 +25,7 @@ #include #include -#include -#include +#include #include "error.h" #include "graph/message/iterator.h" diff --git a/src/lib/error.h b/src/lib/error.h index e23494d2..d2895cbf 100644 --- a/src/lib/error.h +++ b/src/lib/error.h @@ -25,8 +25,7 @@ #include #include -#include -#include +#include #include "lib/object.h" #include "common/macros.h" diff --git a/src/lib/func-status.h b/src/lib/func-status.h index ed3dd0cc..c1ed154d 100644 --- a/src/lib/func-status.h +++ b/src/lib/func-status.h @@ -23,9 +23,8 @@ * SOFTWARE. */ -#define __BT_FUNC_STATUS_ENABLE +#define __BT_IN_BABELTRACE_H #include -#undef __BT_FUNC_STATUS_ENABLE /* * Aliases without a `__` prefix for internal code: this is just easier @@ -44,6 +43,4 @@ #define BT_FUNC_STATUS_UNSUPPORTED __BT_FUNC_STATUS_UNSUPPORTED #define BT_FUNC_STATUS_CANCELED __BT_FUNC_STATUS_CANCELED -#include - #endif /* BABELTRACE_FUNC_STATUS_INTERNAL_H */ diff --git a/src/lib/lib-logging.c b/src/lib/lib-logging.c index 16cd09b9..836ee9ad 100644 --- a/src/lib/lib-logging.c +++ b/src/lib/lib-logging.c @@ -33,10 +33,7 @@ #include #include "common/common.h" #include "common/uuid.h" -#include -#include -#include -#include +#include #include "logging.h" #include "assert-pre.h" diff --git a/src/lib/logging.c b/src/lib/logging.c index f4673543..0dd106de 100644 --- a/src/lib/logging.c +++ b/src/lib/logging.c @@ -21,8 +21,7 @@ */ #include -#include -#include +#include #define BT_LOG_TAG "LIB/LOGGING" #include "lib/logging.h" diff --git a/src/lib/property.h b/src/lib/property.h index 9bc3f482..24fc52a1 100644 --- a/src/lib/property.h +++ b/src/lib/property.h @@ -24,8 +24,7 @@ */ #include "common/assert.h" -#include -#include +#include #include #include #include diff --git a/src/lib/util.c b/src/lib/util.c index 3e3eb45e..a52daf9a 100644 --- a/src/lib/util.c +++ b/src/lib/util.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "lib/trace-ir/utils.h" bt_util_status bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles, diff --git a/src/lib/value.c b/src/lib/value.c index 4f5d55e0..0fdb060d 100644 --- a/src/lib/value.c +++ b/src/lib/value.c @@ -27,12 +27,11 @@ #include #include #include +#include + #include "compat/compiler.h" #include "common/common.h" -#include -#include #include "compat/glib.h" -#include #include "lib/assert-pre.h" #include "lib/value.h" #include "common/assert.h" diff --git a/src/lib/value.h b/src/lib/value.h index 9a6355e9..26a1d9c0 100644 --- a/src/lib/value.h +++ b/src/lib/value.h @@ -23,11 +23,10 @@ * SOFTWARE. */ -#include "lib/object.h" -#include -#include -#include #include +#include + +#include "lib/object.h" #include "common/macros.h" struct bt_value { diff --git a/src/logging/log.h b/src/logging/log.h index 236f28f5..20754c1f 100644 --- a/src/logging/log.h +++ b/src/logging/log.h @@ -13,7 +13,8 @@ #include #include #include -#include +#include + #include "common/macros.h" #include "common/assert.h" diff --git a/src/plugins/comp-logging.h b/src/plugins/comp-logging.h index c3402d24..6e55c671 100644 --- a/src/plugins/comp-logging.h +++ b/src/plugins/comp-logging.h @@ -36,9 +36,7 @@ #endif #include -#include -#include -#include +#include #include "logging/log.h" #define _BT_COMP_LOG_COMP_PREFIX "[%s] " diff --git a/tests/ctf-writer/ctf_writer.c b/tests/ctf-writer/ctf_writer.c index 81dc58d7..b393b947 100644 --- a/tests/ctf-writer/ctf_writer.c +++ b/tests/ctf-writer/ctf_writer.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include "compat/stdlib.h" -- 2.34.1