aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libctf/ctf-create.c4
-rw-r--r--libctf/ctf-link.c2
-rw-r--r--libctf/ctf-serialize.c8
-rw-r--r--libctf/ctf-types.c2
-rw-r--r--libctf/swap.h2
5 files changed, 11 insertions, 7 deletions
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index d0255e5..21fbad7 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -551,6 +551,10 @@ ctf_add_encoded (ctf_dict_t *fp, uint32_t flag,
case CTF_K_FLOAT:
encoding = CTF_FP_DATA (ep->cte_format, ep->cte_offset, ep->cte_bits);
break;
+ default:
+ /* ctf_assert is opaque with -fno-inline. This dead code avoids
+ a warning about "encoding" being used uninitialized. */
+ return CTF_ERR;
}
memcpy (dtd->dtd_vlen, &encoding, sizeof (encoding));
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index d5433b9..360bc1a 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -762,7 +762,7 @@ ctf_link_deduplicating_open_inputs (ctf_dict_t *fp, ctf_dynhash_t *cu_names,
ctf_link_input_t *one_input;
ctf_dict_t *one_fp;
ctf_dict_t *parent_fp = NULL;
- uint32_t parent_i;
+ uint32_t parent_i = 0;
ctf_next_t *j = NULL;
/* If we are processing CU names, get the real input. All the inputs
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c
index 8645f32..11cbe75 100644
--- a/libctf/ctf-serialize.c
+++ b/libctf/ctf-serialize.c
@@ -202,17 +202,15 @@ symtypetab_density (ctf_dict_t *fp, ctf_dict_t *symfp, ctf_dynhash_t *symhash,
}
ctf_dynhash_remove (linker_known, name);
- }
- *unpadsize += sizeof (uint32_t);
- (*count)++;
- if (!(flags & CTF_SYMTYPETAB_FORCE_INDEXED))
- {
if (*max < sym->st_symidx)
*max = sym->st_symidx;
}
else
(*max)++;
+
+ *unpadsize += sizeof (uint32_t);
+ (*count)++;
}
if (err != ECTF_NEXT_END)
{
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c
index 6dc723d..0eaafa1 100644
--- a/libctf/ctf-types.c
+++ b/libctf/ctf-types.c
@@ -1646,7 +1646,7 @@ ctf_type_rvisit (ctf_dict_t *fp, ctf_id_t type, ctf_visit_f *func,
{
ctf_dict_t *ofp = fp;
ctf_id_t otype = type;
- const ctf_type_t *tp;
+ const ctf_type_t *tp = NULL;
const ctf_dtdef_t *dtd;
unsigned char *vlen;
ssize_t size, increment, vbytes;
diff --git a/libctf/swap.h b/libctf/swap.h
index d004dc1..2e2b697 100644
--- a/libctf/swap.h
+++ b/libctf/swap.h
@@ -67,8 +67,10 @@ bswap_64 (uint64_t v)
/* < C11? define away static assertions. */
#if !defined (__STDC_VERSION__) || __STDC_VERSION__ < 201112L
+#ifndef _Static_assert
#define _Static_assert(cond, err)
#endif
+#endif
/* Swap the endianness of something. */