History

Prevent dead code on !x86 in prepare_dynamic_rel

In prepare_dynamic_rel() on non x86 targets the count++ statements appear before any case label and are therefore dead code. This triggers build failure when building with -Werror. This patch adds an extra guard around all the x86 case labels and their associated action, leaving just the default case label for non x86 targets which builds fine.

Thomas Preud'homme committed 8 years ago

Commit 776aa0c1 parent 3e6515b1 file · +2 −0Browse files

Unified · Split

tccelf.c+2−0
@@ -873,6 +873,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr) · 872 unmodified lines
873873 sym_index = ELFW(R_SYM)(rel->r_info);
874874 type = ELFW(R_TYPE)(rel->r_info);
875875 switch(type) {
876+#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
876877 #if defined(TCC_TARGET_I386)
877878 case R_386_32:
878879 if (!get_sym_attr(s1, sym_index, 0)->dyn_index
@@ -896,6 +897,7 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr) · 17 unmodified lines
896897 if (get_sym_attr(s1, sym_index, 0)->dyn_index)
897898 count++;
898899 break;
900+#endif
899901 default:
900902 break;
901903 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t