gencpu.cpp: cleanup / compilation warning fixes

many const fixes, added a few runtime checks, and added NORETURN to term.
fine by me at least (though I'd rather see term(NULL) used so it is more clear the argument is a pointer).