The overall history is that Stan used to be one project. That was for what is now Stan, Math, CmdStan, and RStan. RStan always had a separate build process, but Stan, Math, and CmdStan shared one set of makefiles that worked cross platform. We relied on make to do a few things for us: 1) build target for bin/stanc; once upon a time on Windows, we had MSVC build bin/stanc and g++ build a Stan program, 2) build and execute tests; we now leave the makefile to build tests and use the python script to execute it which has simplified the makefiles a lot, and 3) build Stan program executables.
For CmdStan, Stan, and Math (and for a time, RStan, but not anymore), we’ve made it a priority to have 0 compiler warnings. Early on, we’d get a lot of activity on the users list with every compiler warning. We (mostly Bob and I), got the warnings down to 0 and we’ve been maintaining that.
These flags are what we added to kill some of the warnings that were difficult to fix in code. For example, the
-Wno-uninitialized flag pops up a lot in the generated C++ code.
And of course, a lot of these flags were added without much thought with updated versions of different compilers on Travis CI or sometimes on Jenkins.