Fix all -Wdiscarded-qualifiers warning instances
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 13 Feb 2020 15:36:31 +0000 (10:36 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Mar 2020 05:31:48 +0000 (01:31 -0400)
Change-Id: I85246856d284d5a2dad9609f5fb06d32a89dbb7c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
28 files changed:
configure.ac
src/bin/lttng-crash/lttng-crash.c
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/modprobe.c
src/bin/lttng-sessiond/sessiond-config.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng/commands/add_context.c
src/bin/lttng/commands/create.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/track-untrack.c
src/bin/lttng/commands/view.c
src/bin/lttng/conf.c
src/bin/lttng/lttng.c
src/common/lttng-elf.c
src/common/relayd/relayd.c
src/lib/lttng-ctl/filter/filter-ast.h
src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c
src/lib/lttng-ctl/lttng-ctl.c
tests/regression/tools/live/live_test.c
tests/regression/ust/fork/fork.c
tests/regression/ust/low-throughput/tp.h
tests/unit/test_relayd_backward_compat_group_by_session.c
tests/unit/test_session.c
tests/unit/test_utils_expand_path.c
tests/unit/test_utils_parse_size_suffix.c
tests/unit/test_utils_parse_time_suffix.c
tests/utils/tap/tap.c
tests/utils/tap/tap.h

index e3b23f4658b87874b857eec6774050c93474fda3..a997ba3b9e6c62d2e6148ecb09ae1b524cabaa27 100644 (file)
@@ -38,6 +38,7 @@ AX_APPEND_COMPILE_FLAGS([ dnl
                dnl extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
                dnl            ^
                -Wno-incomplete-setjmp-declaration dnl
+               -Wdiscarded-qualifiers dnl
        ],
        [WARN_CFLAGS],
        [-Werror])
index c0bf42c5a58076b407eb46c50a567a4825f61894..98c52c59dcd835a2c48cde3def2543d025f13132 100644 (file)
@@ -180,9 +180,9 @@ struct lttng_crash_layout {
 };
 
 /* Variables */
-static char *progname,
-       *opt_viewer_path = NULL,
-       *opt_output_path = NULL;
+static const char *progname;
+static char *opt_viewer_path = NULL;
+static char *opt_output_path = NULL;
 
 static char *input_path;
 
@@ -296,7 +296,7 @@ static int parse_args(int argc, char **argv)
        }
 
        if (!opt_viewer_path) {
-               opt_viewer_path = DEFAULT_VIEWER;
+               opt_viewer_path = (char *) DEFAULT_VIEWER;
        }
 
        /* No leftovers, or more than one input path, print usage and quit */
index ae0e020924b38b1929d97a1857c27eb382d5826a..473491f37965459ffb2d260601f05d273b0b7260 100644 (file)
@@ -182,7 +182,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                case LTTNG_CONSUMER64_UST:
                {
                        if (config.consumerd64_lib_dir.value) {
-                               char *tmp;
+                               const char *tmp;
                                size_t tmplen;
                                char *tmpnew;
 
@@ -219,7 +219,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                case LTTNG_CONSUMER32_UST:
                {
                        if (config.consumerd32_lib_dir.value) {
-                               char *tmp;
+                               const char *tmp;
                                size_t tmplen;
                                char *tmpnew;
 
index 66e80e75b26dbc1b5ae8bfa4e122c37136ceadfa..cf9c12b3c81b5bfad2bf1d55ecab21fd3d8ddc81 100644 (file)
 
 /* LTTng kernel tracer mandatory core modules list */
 struct kern_modules_param kern_modules_control_core[] = {
-       { "lttng-ring-buffer-client-discard" },
-       { "lttng-ring-buffer-client-overwrite" },
-       { "lttng-ring-buffer-metadata-client" },
-       { "lttng-ring-buffer-client-mmap-discard" },
-       { "lttng-ring-buffer-client-mmap-overwrite" },
-       { "lttng-ring-buffer-metadata-mmap-client" },
+       { (char *) "lttng-ring-buffer-client-discard" },
+       { (char *) "lttng-ring-buffer-client-overwrite" },
+       { (char *) "lttng-ring-buffer-metadata-client" },
+       { (char *) "lttng-ring-buffer-client-mmap-discard" },
+       { (char *) "lttng-ring-buffer-client-mmap-overwrite" },
+       { (char *) "lttng-ring-buffer-metadata-mmap-client" },
 };
 
 /* LTTng kernel tracer probe modules list */
 struct kern_modules_param kern_modules_probes_default[] = {
-       { "lttng-probe-asoc" },
-       { "lttng-probe-block" },
-       { "lttng-probe-btrfs" },
-       { "lttng-probe-compaction" },
-       { "lttng-probe-ext3" },
-       { "lttng-probe-ext4" },
-       { "lttng-probe-gpio" },
-       { "lttng-probe-i2c" },
-       { "lttng-probe-irq" },
-       { "lttng-probe-jbd" },
-       { "lttng-probe-jbd2" },
-       { "lttng-probe-kmem" },
-       { "lttng-probe-kvm" },
-       { "lttng-probe-kvm-x86" },
-       { "lttng-probe-kvm-x86-mmu" },
-       { "lttng-probe-lock" },
-       { "lttng-probe-module" },
-       { "lttng-probe-napi" },
-       { "lttng-probe-net" },
-       { "lttng-probe-power" },
-       { "lttng-probe-preemptirq" },
-       { "lttng-probe-printk" },
-       { "lttng-probe-random" },
-       { "lttng-probe-rcu" },
-       { "lttng-probe-regmap" },
-       { "lttng-probe-regulator" },
-       { "lttng-probe-rpm" },
-       { "lttng-probe-sched" },
-       { "lttng-probe-scsi" },
-       { "lttng-probe-signal" },
-       { "lttng-probe-skb" },
-       { "lttng-probe-sock" },
-       { "lttng-probe-statedump" },
-       { "lttng-probe-sunrpc" },
-       { "lttng-probe-timer" },
-       { "lttng-probe-udp" },
-       { "lttng-probe-vmscan" },
-       { "lttng-probe-v4l2" },
-       { "lttng-probe-workqueue" },
-       { "lttng-probe-writeback" },
-       { "lttng-probe-x86-irq-vectors" },
-       { "lttng-probe-x86-exceptions" },
+       { (char *) "lttng-probe-asoc" },
+       { (char *) "lttng-probe-block" },
+       { (char *) "lttng-probe-btrfs" },
+       { (char *) "lttng-probe-compaction" },
+       { (char *) "lttng-probe-ext3" },
+       { (char *) "lttng-probe-ext4" },
+       { (char *) "lttng-probe-gpio" },
+       { (char *) "lttng-probe-i2c" },
+       { (char *) "lttng-probe-irq" },
+       { (char *) "lttng-probe-jbd" },
+       { (char *) "lttng-probe-jbd2" },
+       { (char *) "lttng-probe-kmem" },
+       { (char *) "lttng-probe-kvm" },
+       { (char *) "lttng-probe-kvm-x86" },
+       { (char *) "lttng-probe-kvm-x86-mmu" },
+       { (char *) "lttng-probe-lock" },
+       { (char *) "lttng-probe-module" },
+       { (char *) "lttng-probe-napi" },
+       { (char *) "lttng-probe-net" },
+       { (char *) "lttng-probe-power" },
+       { (char *) "lttng-probe-preemptirq" },
+       { (char *) "lttng-probe-printk" },
+       { (char *) "lttng-probe-random" },
+       { (char *) "lttng-probe-rcu" },
+       { (char *) "lttng-probe-regmap" },
+       { (char *) "lttng-probe-regulator" },
+       { (char *) "lttng-probe-rpm" },
+       { (char *) "lttng-probe-sched" },
+       { (char *) "lttng-probe-scsi" },
+       { (char *) "lttng-probe-signal" },
+       { (char *) "lttng-probe-skb" },
+       { (char *) "lttng-probe-sock" },
+       { (char *) "lttng-probe-statedump" },
+       { (char *) "lttng-probe-sunrpc" },
+       { (char *) "lttng-probe-timer" },
+       { (char *) "lttng-probe-udp" },
+       { (char *) "lttng-probe-vmscan" },
+       { (char *) "lttng-probe-v4l2" },
+       { (char *) "lttng-probe-workqueue" },
+       { (char *) "lttng-probe-writeback" },
+       { (char *) "lttng-probe-x86-irq-vectors" },
+       { (char *) "lttng-probe-x86-exceptions" },
 };
 
 /* dynamic probe modules list */
index d908da9727452c215e308f208acd5bcaa7afacc2..f0ab4ce0423530b25a6de8beb599a46fcd08ecec 100644 (file)
@@ -31,7 +31,7 @@ struct sessiond_config sessiond_config_build_defaults = {
        .daemonize =                            false,
        .sig_parent =                           false,
 
-       .tracing_group_name.value =             DEFAULT_TRACING_GROUP,
+       .tracing_group_name.value =             (char *) DEFAULT_TRACING_GROUP,
        .kmod_probes_list.value =               NULL,
        .kmod_extra_probes_list.value =         NULL,
 
index cf74703c34be55cea413af6e2261b81740f870a2..ba63922cb36c9041edf55814c211a6a90ec34089 100644 (file)
@@ -1019,7 +1019,7 @@ error_free:
  * Alloc new UST app channel.
  */
 static
-struct ust_app_channel *alloc_ust_app_channel(char *name,
+struct ust_app_channel *alloc_ust_app_channel(const char *name,
                struct ust_app_session *ua_sess,
                struct lttng_ust_channel_attr *attr)
 {
index 4122025728255114662c74f3d431165a01e4a41c..994cd49eb32037b898dc3fcac9853c3681ebd9a9 100644 (file)
@@ -184,19 +184,19 @@ static struct poptOption long_options[] = {
  */
 #define PERF_HW(optstr, name, type, hide)                              \
        {                                                               \
-               optstr, type, hide,                                     \
+               (char *) optstr, type, hide,                            \
                .u.perf = { PERF_TYPE_HARDWARE, PERF_COUNT_HW_##name, },\
        }
 
 #define PERF_SW(optstr, name, type, hide)                              \
        {                                                               \
-               optstr, type, hide,                                     \
+               (char *) optstr, type, hide,                            \
                .u.perf = { PERF_TYPE_SOFTWARE, PERF_COUNT_SW_##name, },\
        }
 
 #define _PERF_HW_CACHE(optstr, name, type, op, result, hide)           \
        {                                                               \
-               optstr, type, hide,                                     \
+               (char *) optstr, type, hide,                            \
                .u.perf = {                                             \
                        PERF_TYPE_HW_CACHE,                             \
                        (uint64_t) PERF_COUNT_HW_CACHE_##name           \
@@ -235,45 +235,49 @@ const struct ctx_opts {
                } app_ctx;
        } u;
 } ctx_opts[] = {
-       { "pid", CONTEXT_PID },
-       { "procname", CONTEXT_PROCNAME },
-       { "prio", CONTEXT_PRIO },
-       { "nice", CONTEXT_NICE },
-       { "vpid", CONTEXT_VPID },
-       { "tid", CONTEXT_TID },
-       { "pthread_id", CONTEXT_PTHREAD_ID },
-       { "vtid", CONTEXT_VTID },
-       { "ppid", CONTEXT_PPID },
-       { "vppid", CONTEXT_VPPID },
-       { "hostname", CONTEXT_HOSTNAME },
-       { "ip", CONTEXT_IP },
-       { "interruptible", CONTEXT_INTERRUPTIBLE },
-       { "preemptible", CONTEXT_PREEMPTIBLE },
-       { "need_reschedule", CONTEXT_NEED_RESCHEDULE },
-       { "migratable", CONTEXT_MIGRATABLE },
-       { "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
+       /*
+        * These (char *) casts (as well as those in the PERF_* macros) are
+        * safe because we never free these instances of `struct ctx_opts`.
+        */
+       { (char *) "pid", CONTEXT_PID },
+       { (char *) "procname", CONTEXT_PROCNAME },
+       { (char *) "prio", CONTEXT_PRIO },
+       { (char *) "nice", CONTEXT_NICE },
+       { (char *) "vpid", CONTEXT_VPID },
+       { (char *) "tid", CONTEXT_TID },
+       { (char *) "pthread_id", CONTEXT_PTHREAD_ID },
+       { (char *) "vtid", CONTEXT_VTID },
+       { (char *) "ppid", CONTEXT_PPID },
+       { (char *) "vppid", CONTEXT_VPPID },
+       { (char *) "hostname", CONTEXT_HOSTNAME },
+       { (char *) "ip", CONTEXT_IP },
+       { (char *) "interruptible", CONTEXT_INTERRUPTIBLE },
+       { (char *) "preemptible", CONTEXT_PREEMPTIBLE },
+       { (char *) "need_reschedule", CONTEXT_NEED_RESCHEDULE },
+       { (char *) "migratable", CONTEXT_MIGRATABLE },
+       { (char *) "callstack-kernel", CONTEXT_CALLSTACK_KERNEL },
 #if HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT
-       { "callstack-user", CONTEXT_CALLSTACK_USER },
+       { (char *) "callstack-user", CONTEXT_CALLSTACK_USER },
 #endif
-       { "cgroup_ns", CONTEXT_CGROUP_NS },
-       { "ipc_ns", CONTEXT_IPC_NS },
-       { "mnt_ns", CONTEXT_MNT_NS },
-       { "net_ns", CONTEXT_NET_NS },
-       { "pid_ns", CONTEXT_PID_NS },
-       { "user_ns", CONTEXT_USER_NS },
-       { "uts_ns", CONTEXT_UTS_NS },
-       { "uid", CONTEXT_UID },
-       { "euid", CONTEXT_EUID },
-       { "suid", CONTEXT_SUID },
-       { "gid", CONTEXT_GID },
-       { "egid", CONTEXT_EGID },
-       { "sgid", CONTEXT_SGID },
-       { "vuid", CONTEXT_VUID },
-       { "veuid", CONTEXT_VEUID },
-       { "vsuid", CONTEXT_VSUID },
-       { "vgid", CONTEXT_VGID },
-       { "vegid", CONTEXT_VEGID },
-       { "vsgid", CONTEXT_VSGID },
+       { (char *) "cgroup_ns", CONTEXT_CGROUP_NS },
+       { (char *) "ipc_ns", CONTEXT_IPC_NS },
+       { (char *) "mnt_ns", CONTEXT_MNT_NS },
+       { (char *) "net_ns", CONTEXT_NET_NS },
+       { (char *) "pid_ns", CONTEXT_PID_NS },
+       { (char *) "user_ns", CONTEXT_USER_NS },
+       { (char *) "uts_ns", CONTEXT_UTS_NS },
+       { (char *) "uid", CONTEXT_UID },
+       { (char *) "euid", CONTEXT_EUID },
+       { (char *) "suid", CONTEXT_SUID },
+       { (char *) "gid", CONTEXT_GID },
+       { (char *) "egid", CONTEXT_EGID },
+       { (char *) "sgid", CONTEXT_SGID },
+       { (char *) "vuid", CONTEXT_VUID },
+       { (char *) "veuid", CONTEXT_VEUID },
+       { (char *) "vsuid", CONTEXT_VSUID },
+       { (char *) "vgid", CONTEXT_VGID },
+       { (char *) "vegid", CONTEXT_VEGID },
+       { (char *) "vsgid", CONTEXT_VSGID },
 
        /* Perf options */
 
index 406bfb62ac32e0a64b6b98628a4948e8f4f83c87..379ca0a660908c1e3454fafd3d193b83e029e081 100644 (file)
@@ -501,7 +501,7 @@ error:
  *
  *  Spawn a session daemon by forking and execv.
  */
-static int spawn_sessiond(char *pathname)
+static int spawn_sessiond(const char *pathname)
 {
        int ret = 0;
        pid_t pid;
@@ -580,7 +580,7 @@ end:
 static int launch_sessiond(void)
 {
        int ret;
-       char *pathname = NULL;
+       const char *pathname = NULL;
 
        ret = lttng_session_daemon_alive();
        if (ret) {
index 9909fec39c7ca49a7b9d6f75c1a34ffe09a955a6..501c3cf3aa7bc31caecf8792a68a5966c4086594 100644 (file)
@@ -106,7 +106,7 @@ const char *print_event_type(const enum lttng_event_type ev_type)
  * enabled is 0 or 1
  * success is 0 or 1
  */
-static int mi_print_event(char *event_name, int enabled, int success)
+static int mi_print_event(const char *event_name, int enabled, int success)
 {
        int ret;
 
index 06fd528ab5330589f6949d30551a093af970bc6b..c674faefa625d98292522151956c6870d14b57c0 100644 (file)
@@ -451,7 +451,7 @@ static enum cmd_error_code track_untrack_id(enum cmd_type cmd_type,
 
                ret = cmd_func(handle, tracker_type, item);
                if (ret) {
-                       char *msg = NULL;
+                       const char *msg = NULL;
 
                        switch (-ret) {
                        case LTTNG_ERR_ID_TRACKED:
index 0dd1623ea1f7dd5db575a60e550a482d583f411c..b9f3553b32511fd142de47f71a1e6468a24a105e 100644 (file)
@@ -180,8 +180,8 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len,
        memcpy(argv, opts, sizeof(char *) * opts_len);
 
        if (session_live_mode) {
-               argv[opts_len] = "-i";
-               argv[opts_len + 1] = "lttng-live";
+               argv[opts_len] = (char *) "-i";
+               argv[opts_len + 1] = (char *) "lttng-live";
                argv[opts_len + 2] = (char *) trace_path;
                argv[opts_len + 3] = NULL;
        } else {
index 9e1773bb4b90aa39da30a6a0b3fb2de865ea6a5d..8e703b05841b0a7c19302d8a51f8635e97de6250 100644 (file)
@@ -266,7 +266,7 @@ char *config_read_session_name_quiet(const char *path)
 int config_add_session_name(const char *path, const char *name)
 {
        int ret;
-       char *attr = "session=";
+       const char *attr = "session=";
        /* Max name len accepted plus attribute's len and the NULL byte. */
        char session_name[NAME_MAX + strlen(attr) + 1];
 
index 84dc3a748f6d49596866f72d245e819eb63f5c39..4907a43ba19595cc1b90906a59e2012088007cf8 100644 (file)
@@ -33,7 +33,7 @@ NULL
 ;
 
 /* Variables */
-static char *progname;
+static const char *progname;
 int opt_no_sessiond;
 char *opt_sessiond_path;
 
index 816dd0d7621a15a3dc6b2f073c2acc9a583fa02a..bef20ffd4bd52eceb7fec353f885e22e6e9db6d8 100644 (file)
@@ -750,7 +750,7 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
        char *curr_sym_str = NULL;
        char *symbol_table_data = NULL;
        char *string_table_data = NULL;
-       char *string_table_name = NULL;
+       const char *string_table_name = NULL;
        struct lttng_elf_shdr symtab_hdr;
        struct lttng_elf_shdr strtab_hdr;
        struct lttng_elf *elf = NULL;
index 7b11c81f63ed8ebfead0d36a919f4e0ec2e06dce..dfcb337a0bcd7859524faf171ed5594ade38b53c 100644 (file)
@@ -499,7 +499,7 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
        int ret;
        struct lttcomm_relayd_status_stream reply;
        char pathname[RELAYD_COMM_LTTNG_PATH_MAX];
-       char *separator;
+       const char *separator;
 
        /* Code flow error. Safety net. */
        assert(rsock);
index fd322df3f93aa578e842363e9c4abea91253fcc8..926d8dd644a94004ccef75ce35028d290901666c 100644 (file)
@@ -115,10 +115,10 @@ struct filter_node {
                        enum ast_link_type post_op;     /* reverse */
                        enum ast_link_type pre_op;      /* forward */
                        union {
-                               char *string;
+                               const char *string;
                                uint64_t constant;
                                double float_constant;
-                               char *identifier;
+                               const char *identifier;
                                /*
                                 * child can be nested.
                                 */
index 024aac6398ab068ac2d9a2ff860e7cd65f5d5287..11c6b610c1276893ea4986dd18fc9a090f02fdc4 100644 (file)
@@ -77,7 +77,7 @@ enum ir_load_string_type get_literal_string_type(const char *string)
 }
 
 static
-struct ir_op *make_op_load_string(char *string, enum ir_side side)
+struct ir_op *make_op_load_string(const char *string, enum ir_side side)
 {
        struct ir_op *op;
 
@@ -187,7 +187,7 @@ struct ir_load_expression *create_load_expression(struct filter_node *node)
 {
        struct ir_load_expression *load_exp;
        struct ir_load_expression_op *load_exp_op, *prev_op;
-       char *str;
+       const char *str;
 
        /* Get forward chain. */
        node = load_expression_get_forward_chain(node);
index 4e49120732da5f5753e7322c5e60d99163e5881c..32ca4b2677a3808adcda2e9a4a28754205c20e89 100644 (file)
@@ -896,7 +896,7 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev)
 
        /* Add loglevel filtering if any for the JUL domain. */
        if (ev->loglevel_type != LTTNG_EVENT_LOGLEVEL_ALL) {
-               char *op;
+               const char *op;
 
                if (ev->loglevel_type == LTTNG_EVENT_LOGLEVEL_RANGE) {
                        op = ">=";
index d5da03e4d7d4417ed7bdfee5e996430cc4204d85..bfbd842c0e1f2754e367e130b60afec7a36c9c53 100644 (file)
@@ -97,7 +97,7 @@ ssize_t lttng_live_send(int fd, const void *buf, size_t len)
 }
 
 static
-int connect_viewer(char *hostname)
+int connect_viewer(const char *hostname)
 {
        struct hostent *host;
        struct sockaddr_in server_addr;
index 55c9d49bc47792cf0101e7d31dcc9829e71a5faa..7030a293d532db5d81cca4fa96c1948a938b7f55 100644 (file)
@@ -34,7 +34,7 @@ int main(int argc, char **argv, char *env[])
                return 1;
        }
        if (result == 0) {
-               char *args[] = { "fork2", NULL };
+               char *args[] = { (char *) "fork2", NULL };
 
                tracepoint(ust_tests_fork, after_fork_child, getpid());
 
index 3fa8c9a2dd9e5f08c52cc918e61a3888e0b211a1..3ec3c40c199b0918607a68e8d64a5652e698b0d3 100644 (file)
@@ -14,7 +14,7 @@
 #include <lttng/tracepoint.h>
 
 TRACEPOINT_EVENT(tp, slow,
-       TP_ARGS(unsigned int, c, char *, thread_name),
+       TP_ARGS(unsigned int, c, const char *, thread_name),
        TP_FIELDS(
                ctf_integer(unsigned int, counter, c)
                ctf_string(th_name, thread_name)
index c5c9f1b9890e64fd6f13692c177cddf0db64a4d1..d068372faff80e4b2282b960cda8d45981ce6af7 100644 (file)
 #define NUM_TESTS_PER_TEST 1
 
 struct test {
-       char *stream_path;
-       char *session_name;
-       char *hostname;
-       char *creation_time;
-       char *extra_path;
-       char *leftover;
+       const char *stream_path;
+       const char *session_name;
+       const char *hostname;
+       const char *creation_time;
+       const char *extra_path;
+       const char *leftover;
        bool is_valid;
 };
 
index 94e93cd808f6e1ace74133371da576a52d5ae05c..2103a8f46634b2a46844625e93a89133f9f04366 100644 (file)
@@ -66,7 +66,7 @@ static char *get_random_string(void)
 /*
  * Return 0 if session name is found, else -1
  */
-static int find_session_name(char *name)
+static int find_session_name(const char *name)
 {
        struct ltt_session *iter;
 
@@ -110,7 +110,7 @@ static void empty_session_list(void)
 /*
  * Test creation of 1 session
  */
-static int create_one_session(char *name)
+static int create_one_session(const char *name)
 {
        int ret;
        enum lttng_error_code ret_code;
index e6f5e0c8b1597f538b0aba3ee737648978912aee..d7e7f2b054fb067570ca77543b94ed1405194b11 100644 (file)
@@ -25,19 +25,19 @@ int lttng_opt_verbose = 3;
 int lttng_opt_mi;
 
 struct valid_test_input {
-       char *input;
-       char *relative_part;
-       char *absolute_part;
+       const char *input;
+       const char *relative_part;
+       const char *absolute_part;
 };
 
 struct tree_symlink {
-       char *orig;
-       char *dest;
+       const char *orig;
+       const char *dest;
 };
 
 struct symlink_test_input {
-       char *input;
-       char *expected_result;
+       const char *input;
+       const char *expected_result;
 };
 
 /* Valid test cases */
index 27dbf2c9ad6b020e54600327f04c46088cddc297..4340a69ec639266d96d0bdf1655a9db077d903c5 100644 (file)
@@ -19,7 +19,7 @@ int lttng_opt_verbose = 3;
 int lttng_opt_mi;
 
 struct valid_test_input {
-       char *input;
+       const char *input;
        uint64_t expected_result;
 };
 
@@ -69,7 +69,7 @@ static struct valid_test_input valid_tests_inputs[] = {
 static const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
 /* Invalid test cases */
-static char *invalid_tests_inputs[] = {
+static const char *invalid_tests_inputs[] = {
                "",
                " ",
                "-1",
index 09708edd03e913ec13d57c5492649c9669a5e281..6a1c3280bc4f48fa2ff9bd357db4396b34bfd222 100644 (file)
@@ -20,7 +20,7 @@ int lttng_opt_verbose = 3;
 int lttng_opt_mi;
 
 struct valid_test_input {
-       char *input;
+       const char *input;
        uint64_t expected_result;
 };
 
@@ -56,7 +56,7 @@ static struct valid_test_input valid_tests_inputs[] = {
 static const int num_valid_tests = sizeof(valid_tests_inputs) / sizeof(valid_tests_inputs[0]);
 
 /* Invalid test cases */
-static char *invalid_tests_inputs[] = {
+static const char *invalid_tests_inputs[] = {
                "",
                " ",
                "-1",
index 9c967f82d4e29b5b3a0aa8b7a4570131ddebd838..7395f6fc59b80c14ce5a710ff8018e45d025f861 100644 (file)
@@ -40,7 +40,7 @@ static unsigned int test_count = 0; /* Number of tests that have been run */
 static unsigned int e_tests = 0; /* Expected number of tests to run */
 static unsigned int failures = 0; /* Number of tests that failed */
 static char *todo_msg = NULL;
-static char *todo_msg_fixed = "libtap malloc issue";
+static const char *todo_msg_fixed = "libtap malloc issue";
 static int todo = 0;
 static int test_died = 0;
 
@@ -68,8 +68,8 @@ static void _cleanup(void);
  * test_comment -- a comment to print afterwards, may be NULL
  */
 unsigned int
-_gen_result(int ok, const char *func, char *file, unsigned int line,
-           char *test_name, ...)
+_gen_result(int ok, const char *func, const char *file, unsigned int line,
+           const char *test_name, ...)
 {
        va_list ap;
        char *local_test_name = NULL;
@@ -270,7 +270,7 @@ plan_tests(unsigned int tests)
 }
 
 unsigned int
-diag(char *fmt, ...)
+diag(const char *fmt, ...)
 {
        va_list ap;
 
@@ -294,7 +294,7 @@ _expected_tests(unsigned int tests)
 }
 
 int
-skip(unsigned int n, char *fmt, ...)
+skip(unsigned int n, const char *fmt, ...)
 {
        va_list ap;
        char *skip_msg = NULL;
index 045499a98cdfbde096958164774396d1a0a22319..ab9aad1aa6f9f080c2829f48552ee852582a1a0a 100644 (file)
 
 #define skip_end() } while(0);
 
-unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...);
+unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
 
 int plan_no_plan(void);
 int plan_skip_all(char *);
 int plan_tests(unsigned int);
 
-unsigned int diag(char *, ...);
+unsigned int diag(const char *, ...);
 
-int skip(unsigned int, char *, ...);
+int skip(unsigned int, const char *, ...);
 
 void todo_start(char *, ...);
 void todo_end(void);
This page took 0.042162 seconds and 4 git commands to generate.