Merge from PAL svn to github

Removed generated id lines, reformat and fix cpcheck errors and some gcc warnings.