4. The smallest positive period of the function $y=\sin x \cos x-\sqrt{3} \cos ^{2} x-\frac{\sqrt{3}}{2}$ is ( ).
(A) $\frac{\pi}{4}$
(B) $\frac{7}{2}$
(C) $\pi$
(D) $2 \pi$.
4. C

Translate the text above into English, please retain the original text's line breaks and format, and output the translation result directly.