comparison lwlink/link.c @ 264:346966cffeef

Clean up various warnings when building under -Wall Add some gimmicks to prevent fread() and fwrite() warnings about ignoring the return value. Yes, this is probably not a good thing to do, but doing something with a non-success return value is going to involve crashing out or something anyway. Also fix several warnings about variables used while possibly uninitialized. The code flow shows that this cannot be the case but initializing them to a plausible value at declaration time costs pretty much nothing and it makes gcc happy. Also caught a use of | instead of || which probably would have caused a certain check for duplicate declarations in __os9 sections to behave oddly.
author William Astle <lost@l-w.ca>
date Wed, 06 Feb 2013 21:43:10 -0700
parents 8dd8c3bdca7c
children fcd103148aa6
comparison
equal deleted inserted replaced
263:8dd8c3bdca7c 264:346966cffeef
568 { 568 {
569 int sn; 569 int sn;
570 reloc_t *rl; 570 reloc_t *rl;
571 lw_expr_stack_t *te; 571 lw_expr_stack_t *te;
572 572
573 int rval; 573 // int rval;
574 574
575 575
576 if (fn -> forced == 0) 576 if (fn -> forced == 0)
577 return; 577 return;
578 578
580 { 580 {
581 for (rl = fn -> sections[sn].incompletes; rl; rl = rl -> next) 581 for (rl = fn -> sections[sn].incompletes; rl; rl = rl -> next)
582 { 582 {
583 // do a "simplify" on the expression 583 // do a "simplify" on the expression
584 te = lw_expr_stack_dup(rl -> expr); 584 te = lw_expr_stack_dup(rl -> expr);
585 rval = lw_expr_reval(te, resolve_sym, &(fn -> sections[sn])); 585 lw_expr_reval(te, resolve_sym, &(fn -> sections[sn]));
586 586
587 // is it constant? error out if not 587 // is it constant? error out if not
588 // incompletes will error out during resolve_references() 588 // incompletes will error out during resolve_references()
589 //if (rval != 0 || !lw_expr_is_constant(te)) 589 //if (rval != 0 || !lw_expr_is_constant(te))
590 //{ 590 //{
806 linkscript.modrev &= 15; 806 linkscript.modrev &= 15;
807 linkscript.modattr &= 15; 807 linkscript.modattr &= 15;
808 808
809 if (st.attrseen > 1 || st.typeseen > 1 || 809 if (st.attrseen > 1 || st.typeseen > 1 ||
810 st.langseen > 1 || st.revseen > 1 || 810 st.langseen > 1 || st.revseen > 1 ||
811 st.nameseen > 1 | st.edseen > 1 811 st.nameseen > 1 || st.edseen > 1
812 ) 812 )
813 { 813 {
814 fprintf(stderr, "Warning: multiple instances of __os9 found with duplicate settings of type, lang, attr, rev, edition, or module name.\n"); 814 fprintf(stderr, "Warning: multiple instances of __os9 found with duplicate settings of type, lang, attr, rev, edition, or module name.\n");
815 } 815 }
816 } 816 }