Rename C++ header files to .hpp Rename all C++ header files (include/**/*-internal.h, src/**/*.h except argpar and msgpack, some headers in tests) to have the .hpp extension. Doing so highlights that we include some C++ header files in some test files still compiled as C. This is ok for now, as the files they include don't actually contain C++ code incompatible with C yet, but they could eventually. This is something we can fix later. Change-Id: I8bf326b6b2946a3e26704f3ef3ac5831bbe9bc26 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Remove extern "C" from internal headers All internal code is now compiled as C++, we can now remove all 'extern "C"' declarations from internal headers. This means files will see each other's declarations as C++, and we can now use things in headers. Remove the min/min_t/max/max_t macros from macros.h as well. Change-Id: I5a6b7ef60be5f46160c6d5ca39f082d2137d5a07 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
common: compile libfilter as C++ This patch renames filter-lexer.l to filter-lexer.lpp and filter-parser.y to filter-parser.ypp. That makes automake pass the right options to flex/bison to generate C++ code. In filter-lexer.lpp, Instead of having declarations with the `unused` attribute for yyunput and yyinput, use the noinput and nounput options. The rest of the changes are standard C to C++ conversion stuff. Change-Id: Ie4bf1981b970145f97e8db1d88edaa2d9b95aef4 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bin: compile lttng as C++ Compile the code of the lttng binary as C++ source. - start by renaming all files under src/bin/lttng to have the .cpp extension, adjust Makefile.am accordingly - apply the sophisticated algorithm: while does_not_build(): fix_error() until completion Fixes fall in these categories: - add extern "C" to headers of functions implemented in C. This is likely temporary: at some point some of these things will be implemented in C++, at which point we'll remove the extern "C". - rename mi_lttng_version to mi_lttng_version_data, to avoid a -Wshadow warning about the mi_lttng_version function hiding the mi_lttng_version's struct constructor - we have the same warning about lttng_calibrate, but we can't rename it, it's exposed in a public header. Add some pragmas to disable the warning around there. We will need more macro smartness in case we need to support a compiler that doesn't understand these pragmas. - in filter-ast.h, add a dummy field to the empty struct, to avoid a -Wextern-c-compat warning with clang++ (it warns us that the struct has size 0 in C but size 1 in C++). - in add_context.cpp, we can't initialize ctx_opts' union field like we did in C. Fix that by adding a ctx_opts constructor for each kind of context and implement the PERF_* macros to use them. - need to explicitly cast void pointer to type of the destination, for example the eturn value of allocation functions, or parameter of "destroy" functions - need to explicitly cast when passing an int to an enum parameter, for example an lttng_error_code parameter - remove use of designated array initializers, for example for schedule_type_str in disable_rotation.cpp - fix order of struct initializers to match order of field declarations, for example in list_triggers.cpp, function cmd_list_triggers - rename some things to avoid clashing with keywords, for example in runas.h Change-Id: Id743b141552a412b4104af4dda8969eef5032388 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
common: rename filter bytecode types The filter bytecode is going to be used for implementing capture expressions, so it's not going to be specific to filter. This patch renames the types related to bytecode to remove "filter" from their names. All the changes start in bytecode/bytecode.h, the changes in the other files are only fallouts. - `enum filter_op` is renamed `enum bytecode_op`. - `FILTER_OP_*` enumerators are renamed `BYTECODE_OP_*`. - The `filter_opcode_t` typedef is renamed `bytecode_opcode_t`. - `struct lttng_filter_bytecode_alloc` is renamed `struct lttng_bytecode_alloc`. - `struct lttng_filter_bytecode` is renamed `struct lttng_bytecode`. Change-Id: Iefdc667f3fbf715f868926c90108c6a5580b6f25 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479
common: move bytecode utilities from filter to its own file We'll want to re-use the filter bytecode to implement the trigger event rule condition field captures. This is a preparatory patch that moves some filter bytecode code in a location that is not filter-specific, so it can be used for both filters and captures. The content of common/filter/filter-bytecode.h is moved to common/bytecode/bytecode.h. Some declarations for the various bytecode helpers are added to that file. The implementation for these helpers is moved from common/filter/filter-visitor-generate-bytecode.c to common/bytecode/bytecode.c. The content of src/common/bytecode is built as a library, so it can be used by the filter-grammar-test program. A following patch renames the content of bytecode/bytecode.h to remove the "filter" part. The rest of the changes is just to adapt the code to the changes mentioned above. Change-Id: Id602c9046bdc76791026c5b5a928387145d18e43 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479