Abundances of carbon-bearing diatomic molecules in diffuse interstellar clouds