Skip to content

Commit

Permalink
Fix -Wreturn-type issues.
Browse files Browse the repository at this point in the history
assert() only prevents -Wreturn-type from firing if asserts are
enabled. Add __builtin_unreachable() to make it work with -UNDEBUG.
  • Loading branch information
DanAlbert committed Jun 11, 2015
1 parent 59e02f6 commit 296ebd3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions checkpolicy/module_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ role_datum_t *declare_role(unsigned char isattr)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -364,6 +365,7 @@ type_datum_t *declare_type(unsigned char primary, unsigned char isattr)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -500,6 +502,7 @@ user_datum_t *declare_user(void)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -918,6 +921,7 @@ static int require_role_or_attribute(int pass, unsigned char isattr)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -981,6 +985,8 @@ static int require_type_or_attribute(int pass, unsigned char isattr)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();

}
}
}
Expand Down Expand Up @@ -1042,6 +1048,7 @@ int require_user(int pass)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -1093,6 +1100,7 @@ static int require_bool_tunable(int pass, int is_tunable)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -1166,6 +1174,7 @@ int require_sens(int pass)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down Expand Up @@ -1219,6 +1228,7 @@ int require_cat(int pass)
}
default:{
assert(0); /* should never get here */
__builtin_unreachable();
}
}
}
Expand Down

0 comments on commit 296ebd3

Please sign in to comment.