bin: compile lttng as C++
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 3 Sep 2021 21:31:28 +0000 (17:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Oct 2021 20:57:45 +0000 (16:57 -0400)
commit48a4000561343808724f7cb5fa8c131877489ccd
tree10e0697109cc423d335322e3040b88ff6f7c3ad7
parent81663f073dbfb4b61c06a0ceb8ca33c4fc41b1c5
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>
88 files changed:
configure.ac
include/lttng/condition/condition-internal.h
include/lttng/event-rule/event-rule-internal.h
include/lttng/event-rule/kernel-syscall-internal.h
include/lttng/lttng.h
include/lttng/trigger/trigger-internal.h
src/bin/lttng/Makefile.am
src/bin/lttng/commands/add_context.c [deleted file]
src/bin/lttng/commands/add_context.cpp [new file with mode: 0644]
src/bin/lttng/commands/add_trigger.c [deleted file]
src/bin/lttng/commands/add_trigger.cpp [new file with mode: 0644]
src/bin/lttng/commands/clear.c [deleted file]
src/bin/lttng/commands/clear.cpp [new file with mode: 0644]
src/bin/lttng/commands/create.c [deleted file]
src/bin/lttng/commands/create.cpp [new file with mode: 0644]
src/bin/lttng/commands/destroy.c [deleted file]
src/bin/lttng/commands/destroy.cpp [new file with mode: 0644]
src/bin/lttng/commands/disable_channels.c [deleted file]
src/bin/lttng/commands/disable_channels.cpp [new file with mode: 0644]
src/bin/lttng/commands/disable_events.c [deleted file]
src/bin/lttng/commands/disable_events.cpp [new file with mode: 0644]
src/bin/lttng/commands/disable_rotation.c [deleted file]
src/bin/lttng/commands/disable_rotation.cpp [new file with mode: 0644]
src/bin/lttng/commands/enable_channels.c [deleted file]
src/bin/lttng/commands/enable_channels.cpp [new file with mode: 0644]
src/bin/lttng/commands/enable_events.c [deleted file]
src/bin/lttng/commands/enable_events.cpp [new file with mode: 0644]
src/bin/lttng/commands/enable_rotation.c [deleted file]
src/bin/lttng/commands/enable_rotation.cpp [new file with mode: 0644]
src/bin/lttng/commands/help.c [deleted file]
src/bin/lttng/commands/help.cpp [new file with mode: 0644]
src/bin/lttng/commands/list.c [deleted file]
src/bin/lttng/commands/list.cpp [new file with mode: 0644]
src/bin/lttng/commands/list_triggers.c [deleted file]
src/bin/lttng/commands/list_triggers.cpp [new file with mode: 0644]
src/bin/lttng/commands/load.c [deleted file]
src/bin/lttng/commands/load.cpp [new file with mode: 0644]
src/bin/lttng/commands/metadata.c [deleted file]
src/bin/lttng/commands/metadata.cpp [new file with mode: 0644]
src/bin/lttng/commands/regenerate.c [deleted file]
src/bin/lttng/commands/regenerate.cpp [new file with mode: 0644]
src/bin/lttng/commands/remove_trigger.c [deleted file]
src/bin/lttng/commands/remove_trigger.cpp [new file with mode: 0644]
src/bin/lttng/commands/rotate.c [deleted file]
src/bin/lttng/commands/rotate.cpp [new file with mode: 0644]
src/bin/lttng/commands/save.c [deleted file]
src/bin/lttng/commands/save.cpp [new file with mode: 0644]
src/bin/lttng/commands/set_session.c [deleted file]
src/bin/lttng/commands/set_session.cpp [new file with mode: 0644]
src/bin/lttng/commands/snapshot.c [deleted file]
src/bin/lttng/commands/snapshot.cpp [new file with mode: 0644]
src/bin/lttng/commands/start.c [deleted file]
src/bin/lttng/commands/start.cpp [new file with mode: 0644]
src/bin/lttng/commands/status.c [deleted file]
src/bin/lttng/commands/status.cpp [new file with mode: 0644]
src/bin/lttng/commands/stop.c [deleted file]
src/bin/lttng/commands/stop.cpp [new file with mode: 0644]
src/bin/lttng/commands/track-untrack.c [deleted file]
src/bin/lttng/commands/track-untrack.cpp [new file with mode: 0644]
src/bin/lttng/commands/version.c [deleted file]
src/bin/lttng/commands/version.cpp [new file with mode: 0644]
src/bin/lttng/commands/view.c [deleted file]
src/bin/lttng/commands/view.cpp [new file with mode: 0644]
src/bin/lttng/conf.c [deleted file]
src/bin/lttng/conf.cpp [new file with mode: 0644]
src/bin/lttng/loglevel.c [deleted file]
src/bin/lttng/loglevel.cpp [new file with mode: 0644]
src/bin/lttng/loglevel.h
src/bin/lttng/lttng.c [deleted file]
src/bin/lttng/lttng.cpp [new file with mode: 0644]
src/bin/lttng/uprobe.c [deleted file]
src/bin/lttng/uprobe.cpp [new file with mode: 0644]
src/bin/lttng/utils.c [deleted file]
src/bin/lttng/utils.cpp [new file with mode: 0644]
src/common/argpar/argpar.h
src/common/compat/string.h
src/common/dynamic-array.h
src/common/error.h
src/common/filter/filter-ast.h
src/common/mi-lttng.c
src/common/mi-lttng.h
src/common/runas.h
src/common/spawn-viewer.h
src/common/string-utils/string-utils.h
src/common/time.h
src/common/tracker.h
src/common/uri.h
src/common/utils.h
This page took 0.031513 seconds and 4 git commands to generate.