Fix ARM noassert builds -g/-O{s/0/1/2/3}

Also fixes ARM assert build -O3.

Change-Id: I52bda91308ecfa0e8b23c4140c38c49347cc10f7
This commit is contained in:
Lionel Sambuc 2016-01-23 11:45:33 +01:00
parent 6a76619b7e
commit e1cdaee106
28 changed files with 165 additions and 11 deletions

View File

@ -4065,6 +4065,9 @@ fast_exponent_modulo(mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode
*/
int (*redux)(mp_int*,mp_int*,mp_digit);
#if defined(__minix)
mp = 0; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
#endif /* defined(__minix) */
winsize = find_window_size(X);
/* init M array */

View File

@ -19,6 +19,14 @@ SRCS+=tiger.c
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
MAN=libnetpgpverify.3
WARNS=5
#.if defined(__MINIX)
#LSC: While Compiling with -O3:
#<..>/lib/verify/../../dist/src/netpgpverify/bignum.c:802:5: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]
# if (olduse > ix) {
# ^
# cc1: all warnings being treated as errors
CWARNFLAGS+= -Wno-strict-overflow
#.endif # defined(__MINIX)
EXTDIST=${.CURDIR}/../../dist
.PATH: ${EXTDIST}/src/netpgpverify

View File

@ -301,14 +301,21 @@ static
void
replace_contents(atf_fs_path_t *p, const char *buf)
{
#if !defined(NDEBUG) && defined(__minix)
atf_error_t err;
PRE(atf_dynstr_length(&p->m_data) == strlen(buf));
#endif /* !defined(NDEBUG) && defined(__minix) */
atf_dynstr_clear(&p->m_data);
err = atf_dynstr_append_fmt(&p->m_data, "%s", buf);
#if !defined(NDEBUG) && defined(__minix)
err =
#endif /* !defined(NDEBUG) && defined(__minix) */
atf_dynstr_append_fmt(&p->m_data, "%s", buf);
#if !defined(NDEBUG) && defined(__minix)
INV(!atf_is_error(err));
#endif /* !defined(NDEBUG) && defined(__minix) */
}
static

View File

@ -115,7 +115,10 @@ detail::do_exec(void *v)
if (ea->m_prehook != NULL)
ea->m_prehook();
const int ret = const_execvp(ea->m_prog.c_str(), ea->m_argv.exec_argv());
#if !defined(NDEBUG) && defined(__minix)
const int ret =
#endif /* !defined(NDEBUG) && defined(__minix) */
const_execvp(ea->m_prog.c_str(), ea->m_argv.exec_argv());
const int errnocopy = errno;
assert(ret == -1);
std::cerr << "exec(" << ea->m_prog.str() << ") failed: "

View File

@ -254,7 +254,10 @@ static
void
prepare_child(const tools::fs::path& workdir)
{
const int ret = ::setpgid(::getpid(), 0);
#if !defined(NDEBUG) && defined(__minix)
const int ret =
#endif /* !defined(NDEBUG) && defined(__minix) */
::setpgid(::getpid(), 0);
assert(ret != -1);
::umask(S_IWGRP | S_IWOTH);

View File

@ -113,12 +113,18 @@ impl::timer::timer(const unsigned int seconds) :
impl::timer::~timer(void)
{
#if !defined(NDEBUG) && defined(__minix)
int ret;
ret = ::timer_delete(m_pimpl->m_timer);
ret =
#endif /* !defined(NDEBUG) && defined(__minix) */
::timer_delete(m_pimpl->m_timer);
assert(ret != -1);
ret = ::sigaction(SIGALRM, &m_pimpl->m_old_sa, NULL);
#if !defined(NDEBUG) && defined(__minix)
ret =
#endif /* !defined(NDEBUG) && defined(__minix) */
::sigaction(SIGALRM, &m_pimpl->m_old_sa, NULL);
assert(ret != -1);
}

View File

@ -258,6 +258,10 @@ void sendMTFValues ( EState* s )
UInt16 cost[BZ_N_GROUPS];
Int32 fave[BZ_N_GROUPS];
#if defined(__minix)
/* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
memset(cost, 0, sizeof(cost));
#endif /* defined(__minix) */
UInt16* mtfv = s->mtfv;
if (s->verbosity >= 3)

View File

@ -183,12 +183,16 @@ utils::sanity_failure(const assert_type type, const char* file,
void
utils::install_crash_handlers(const std::string& logfile_)
{
#if !defined(NDEBUG) && defined(__minix)
static bool installed = false;
#endif /* !defined(NDEBUG) && defined(__minix) */
PRE(!installed);
logfile = logfile_;
for (const int* iter = &fatal_signals[0]; *iter != 0; iter++)
install_one_crash_handler(*iter);
#if !defined(NDEBUG) && defined(__minix)
installed = true;
#endif /* !defined(NDEBUG) && defined(__minix) */
}

View File

@ -257,6 +257,10 @@ parse_test_case(FILE* input, FILE* output, char* name)
fgets_no_newline(line, sizeof(line), input) != NULL &&
strcmp(line, "") != 0) {
char* key; char* value;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, with -O3 */
key = value = NULL;
#endif /* defined(__minix) */
error = parse_property(line, &key, &value);
if (!kyua_error_is_set(error)) {
const char* out_key = rewrite_property(key);
@ -301,6 +305,10 @@ parse_tests(FILE* input, FILE* output)
do {
char* key; char* value;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, with -O3 */
key = value = NULL;
#endif /* defined(__minix) */
error = parse_property(line, &key, &value);
if (kyua_error_is_set(error))
break;

View File

@ -393,6 +393,9 @@ read_mtree(struct archive_read *a, struct mtree *mtree)
struct mtree_entry *last_entry;
int r;
#if defined(__minix)
p = NULL; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
#endif /* defined(__minix) */
mtree->archive_format = ARCHIVE_FORMAT_MTREE;
mtree->archive_format_name = "mtree";

View File

@ -597,9 +597,12 @@ pre_bl(PRE_ARGS)
int i, comp, dup;
const char *offs, *width;
enum mdoc_list lt;
#if !defined(NDEBUG) && defined(__minix)
struct mdoc_node *np;
#endif /* !defined(NDEBUG) && defined(__minix) */
if (MDOC_BLOCK != n->type) {
#if !defined(NDEBUG) && defined(__minix)
if (ENDBODY_NOT != n->end) {
assert(n->pending);
np = n->pending->parent;
@ -609,6 +612,7 @@ pre_bl(PRE_ARGS)
assert(np);
assert(MDOC_BLOCK == np->type);
assert(MDOC_Bl == np->tok);
#endif /* !defined(NDEBUG) && defined(__minix) */
return(1);
}
@ -783,9 +787,12 @@ pre_bd(PRE_ARGS)
int i, dup, comp;
enum mdoc_disp dt;
const char *offs;
#if !defined(NDEBUG) && defined(__minix)
struct mdoc_node *np;
#endif /* !defined(NDEBUG) && defined(__minix) */
if (MDOC_BLOCK != n->type) {
#if !defined(NDEBUG) && defined(__minix)
if (ENDBODY_NOT != n->end) {
assert(n->pending);
np = n->pending->parent;
@ -795,6 +802,7 @@ pre_bd(PRE_ARGS)
assert(np);
assert(MDOC_BLOCK == np->type);
assert(MDOC_Bd == np->tok);
#endif /* !defined(NDEBUG) && defined(__minix) */
return(1);
}

View File

@ -582,6 +582,10 @@ vs_sm_up(SCR *sp, MARK *rp, db_recno_t count, scroll_t scmd, SMAP *smp)
{
int cursor_set, echanged, zset;
SMAP *ssmp, s1, s2;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, with -O3 */
ssmp = NULL;
#endif /* defined(__minix) */
/*
* Check to see if movement is possible.

View File

@ -450,6 +450,9 @@ parse_pkg_vuln(const char *input, size_t input_len, int check_sum)
size_t allocated_vulns;
int in_pgp_msg;
#if defined(__minix)
next = NULL; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
#endif /* defined(__minix) */
pv = xmalloc(sizeof(*pv));
allocated_vulns = pv->entries = 0;

View File

@ -281,6 +281,10 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
struct grid_cell active_gc, other_gc;
u_int i, j, type;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized while compiling with -O3 */
wp = NULL;
#endif /* defined(__minix) */
style_apply(&other_gc, oo, "pane-border-style");
style_apply(&active_gc, oo, "pane-active-border-style");
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET;

View File

@ -477,6 +477,10 @@ renice_procs(char *str)
int procnum;
int uid;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized while compiling with -O3. */
prio = 0;
#endif /* defined(__minix) */
ERR_RESET;
uid = getuid();

View File

@ -57331,6 +57331,14 @@ static int balance_nonroot(
** intkey b-tree, then cell i was a divider cell. */
assert( j+1 < ArraySize(apCopy) );
assert( j+1 < nOld );
#if defined(__minix)
/*LSC: While compiling with -O3:
* error: array subscript is above array bounds [-Werror=array-bounds]
* pOld = apCopy[++j];
*/
if (!(j+1 < ArraySize(apCopy)))
abort();
#endif /* defined(__minix) */
pOld = apCopy[++j];
iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
if( pOld->nOverflow ){
@ -140544,6 +140552,9 @@ SQLITE_PRIVATE void sqlite3Fts3Snippet(
for(iRead=0; iRead<pTab->nColumn; iRead++){
SnippetFragment sF = {0, 0, 0, 0};
int iS;
#if defined(__minix)
iS = 0; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
#endif /* defined(__minix) */
if( iCol>=0 && iRead!=iCol ) continue;
/* Find the best snippet of nFToken tokens in column iRead. */

View File

@ -540,6 +540,10 @@ fill_it(int rn, boolean do_rec_de)
static short offsets[4] = {-1, 1, 3, -3};
boolean did_this = 0;
#if defined(__minix)
/* LSC: maybe-uninitialized, when compiling with -O3 */
drow = dcol = 0;
#endif /* defined(__minix)*/
for (i = 0; i < 10; i++) {
srow = get_rand(0, 3);
scol = get_rand(0, 3);

View File

@ -103,7 +103,7 @@ int devman_add_device(struct devman_dev *dev)
{
message msg;
int res;
size_t grant_size;
size_t grant_size = 0;
void *buf = serialize_dev(dev, &grant_size);
if (buf == NULL)

View File

@ -241,7 +241,8 @@ static void sef_lu_state_change(int state, int flags)
sef_lu_flags = flags;
if(sef_lu_state == SEF_LU_STATE_NULL) {
r = sys_statectl(SYS_STATE_CLEAR_IPC_FILTERS, 0, 0);
assert(r == OK);
if(r != OK)
panic("%s:%d: SYS_STATE_CLEAR_IPC_FILTERS failed\n", __func__, __LINE__);
}
if(old_state != sef_lu_state) {
sef_lu_cbs.sef_cb_lu_state_changed(old_state, sef_lu_state);

View File

@ -165,7 +165,8 @@ static int tcp_op_close(struct socket * sock)
}
err = tcp_close(sock->pcb);
assert(err == ERR_OK);
if(err != ERR_OK)
panic("tcp_close failed\n");
sock->pcb = NULL;
}
debug_tcp_print("freed pcb");

View File

@ -386,7 +386,10 @@ int do_vm_call(void)
u32_t length = job_m_in.VFS_VMCALL_LENGTH;
int result = OK;
int slot;
struct fproc *rfp, *vmf;
struct fproc *rfp;
#if !defined(NDEBUG)
struct fproc *vmf;
#endif /* !defined(NDEBUG) */
struct filp *f = NULL;
int r;
@ -396,7 +399,9 @@ int do_vm_call(void)
if(isokendpt(ep, &slot) != OK) rfp = NULL;
else rfp = &fproc[slot];
#if !defined(NDEBUG)
vmf = fproc_addr(VM_PROC_NR);
#endif /* !defined(NDEBUG) */
assert(fp == vmf);
assert(rfp != vmf);

View File

@ -645,7 +645,7 @@ int actual_lseek(struct fproc *rfp, int seekfd, int seekwhence, off_t offset,
int do_lseek(void)
{
/* Perform the lseek(2) system call. */
off_t newpos;
off_t newpos = 0;
int r;
if ((r = actual_lseek(fp, job_m_in.m_lc_vfs_lseek.fd,

View File

@ -1743,7 +1743,14 @@ udf_extattr_append_internal(union dscrptr *dscr, struct extattr_entry *extattr)
extattrhdr = (struct extattrhdr_desc *) data;
l_ea = udf_rw32(*l_eap);
if (l_ea == 0) {
#if !defined(NDEBUG) && defined(__minix)
assert(l_ad == 0);
#else
if (l_ad != 0) {
printf("%s:%d: l_ad != 0\n", __func__, __LINE__);
abort();
}
#endif /* !defined(NDEBUG) && defined(__minix) */
/* create empty extended attribute header */
exthdr_len = sizeof(struct extattrhdr_desc);
@ -2157,6 +2164,10 @@ udf_create_new_rootdir(union dscrptr **dscr)
struct long_ad root_icb;
int filetype, error;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized when compiling with -O3 */
fe = NULL;
#endif /*defined(__minix) */
memset(&root_icb, 0, sizeof(root_icb));
root_icb.len = udf_rw32(context.sector_size);
root_icb.loc.lb_num = udf_rw32(layout.rootdir);

View File

@ -187,6 +187,10 @@ onecol(int argc, char *argv[])
int mor;
int error = 1;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, when compiling with -O3 */
mor = 0;
#endif /* defined(__minix) */
if (nmwd)
num = nmwd + 1;
else

View File

@ -593,14 +593,28 @@ udf_file_inject_blob(union dscrptr *dscr, uint8_t *blob, off_t size)
/* calculate free space */
free_space = context.sector_size - (l_ea + l_ad) - desc_size;
if (udf_datablocks(size)) {
#if !defined(NDEBUG) && defined(__minix)
assert(free_space < size);
#else
if (!(free_space < size)) {
printf("%s:%d not enough free space\n", __FILE__, __LINE__);
abort();
}
#endif /* !defined(NDEBUG) && defined(__minix) */
return 1;
}
/* going internal */
assert(l_ad == 0);
#if !defined(NDEBUG) && defined(__minix)
assert((udf_rw16(icb->flags) & UDF_ICB_TAG_FLAGS_ALLOC_MASK) ==
UDF_ICB_INTERN_ALLOC);
#else
if (!((udf_rw16(icb->flags) & UDF_ICB_TAG_FLAGS_ALLOC_MASK) == UDF_ICB_INTERN_ALLOC)) {
printf("%s:%d: allocation flags mismatch\n", __FILE__, __LINE__);
abort();
}
#endif /* !defined(NDEBUG) && defined(__minix) */
// assert(free_space >= size);
pos = data + l_ea + l_ad;
@ -690,7 +704,14 @@ udf_append_file_mapping(union dscrptr *dscr, struct long_ad *piece)
last_long = NULL;
if (l_ad != 0) {
if (use_shorts) {
#if !defined(NDEBUG) && defined(__minix)
assert(cur_alloc == UDF_ICB_SHORT_ALLOC);
#else
if (!(cur_alloc == UDF_ICB_SHORT_ALLOC)) {
printf("%s:%d: Expecting UDF_ICB_SHORT_ALLOC allocation\n", __FILE__, __LINE__);
abort();
}
#endif /* !defined(NDEBUG) && defined(__minix) */
pos += l_ad - short_len;
last_short = (struct short_ad *) pos;
last_lb_num = udf_rw32(last_short->lb_num);
@ -698,7 +719,14 @@ udf_append_file_mapping(union dscrptr *dscr, struct long_ad *piece)
last_len = UDF_EXT_LEN(udf_rw32(last_short->len));
last_flags = UDF_EXT_FLAGS(udf_rw32(last_short->len));
} else {
#if !defined(NDEBUG) && defined(__minix)
assert(cur_alloc == UDF_ICB_LONG_ALLOC);
#else
if (!(cur_alloc == UDF_ICB_LONG_ALLOC)) {
printf("%s:%d: Expecting UDF_ICB_LONG_ALLOC allocation\n", __FILE__, __LINE__);
abort();
}
#endif /* !defined(NDEBUG) && defined(__minix) */
pos += l_ad - long_len;
last_long = (struct long_ad *) pos;
last_lb_num = udf_rw32(last_long->loc.lb_num);

View File

@ -132,6 +132,10 @@ estimate_size_walk(fsnode *root, char *dir, struct v7fs_geometry *geom)
int n;
off_t sz;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, when compiling with -O3. */
nblk = 0;
#endif /* defined(__minix) */
for (cur = root, nentries = 0; cur != NULL; cur = cur->next,
nentries++, geom->ninode++) {
switch (cur->type & S_IFMT) {
@ -257,6 +261,10 @@ v7fs_estimate(const char *dir, fsnode *root, fsinfo_t *fsopts)
v7fs_daddr_t nblk;
struct v7fs_geometry geom;
#if defined(__minix)
/* LSC: -Werror=maybe-uninitialized, when compiling with -O3. */
nblk = 0;
#endif /* defined(__minix) */
memset(&geom , 0, sizeof(geom));
strncpy(path, dir, sizeof(path));

View File

@ -504,7 +504,11 @@ sign_send_certificate_block(struct signature_group_t *sg)
char *tstamp;
char payload[SIGN_MAX_PAYLOAD_LENGTH];
char sd[SIGN_MAX_SD_LENGTH];
#if !defined(NDEBUG) && defined(__minix)
size_t payload_len, sd_len, fragment_len;
#else
size_t payload_len, fragment_len;
#endif /* !defined(NDEBUG) && defined(__minix) */
size_t payload_index = 0;
/* do nothing if CBs already sent or if there was no message in SG */
@ -529,8 +533,11 @@ sign_send_certificate_block(struct signature_group_t *sg)
else
fragment_len = SIGN_MAX_FRAG_LENGTH;
#if !defined(NDEBUG) && defined(__minix)
/* format SD */
sd_len = snprintf(sd, sizeof(sd), "[ssign-cert "
sd_len =
#endif /* !defined(NDEBUG) && defined(__minix) */
snprintf(sd, sizeof(sd), "[ssign-cert "
"VER=\"%s\" RSID=\"%" PRIuFAST64 "\" SG=\"%d\" "
"SPRI=\"%d\" TBPL=\"%zu\" INDEX=\"%zu\" "
"FLEN=\"%zu\" FRAG=\"%.*s\" "

View File

@ -56,6 +56,7 @@ __RCSID("$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $");
static unsigned getVerifySetting(const char *x509verifystring);
#if !defined(NDEBUG) && defined(__minix)
/* to output SSL error codes */
static const char *SSL_ERRCODE[] = {
"SSL_ERROR_NONE",
@ -80,6 +81,7 @@ static const char *TLS_CONN_STATES[] = {
"ST_CLOSING0",
"ST_CLOSING1",
"ST_CLOSING2"};
#endif /* !defined(NDEBUG) && defined(__minix) */
DH *get_dh1024(void);
/* DH parameter precomputed with "openssl dhparam -C -2 1024" */