Enable GCC warning flag -Wnested-externs, fix warnings