NEVER EVER EVER!!!! WD-40 is a penetrant and it will seep into pistol primers and cause misfires!!
From WD-40's own website. One of the uses they mentioned was the slide mechanism on a pump shotgun. Also, the exterior where there might be spots of rust. Also, I only have a revolver, no semi-automatic.