That's kinda my point. Aren't those "hints" to the compiler?
-O2 means "take more time compiling but produce faster code". This hint will always be valid and useful, regardless of how the codebase changes. Query planner hints can become obsolete as the data distribution changes.
-fwrapv and -fno-strict-aliasing are correctness settings
-Wxxx are just help for the developers