Squash all changes required to compile TH and nn as c++.