compilation-auto-jump-to-first-error option should make Emacs jump to the first error during compilation. However, it seems that Emacs treats warnings and errors in the same way, and jumps to the first one of either. How would you make Emacs jump to the first error if any, or to the first warning otherwise? I would rather fix errors first, and then warnings (especially because warnings could be caused by third-party libraries).
(setq compilation-skip-threshold 2)
Compilation motion commands skip less important messages. The value can be either
2 -- skip anything less than error,
1 -- skip anything less than warning or
0 -- don't skip any messages.
Note that all messages not positively identified as warning or info, are considered errors.