Generalized-gradient approximations to density-functional theory: A comparative study for atoms and solids