Depression of the weak-ferromagnetism of CuO2 planes in Gd2CuO4 through Ce and Th doping