Use GNUC format attribute on print functions

Closes #1059
Fix formatting warnings

Found by #1059