4. Let $a$ be a real number such that the graph of the function $y=f(x)=a \sin 2x + \cos 2x + \sin x + \cos x$ is symmetric about the line $x=-\pi$. Let the set of all such $a$ be denoted by $S$. Then $S$ is ( ).
(A) empty set
(B) singleton set (contains only one element)
(C) finite set with more than one element
(D) infinite set (contains infinitely many elements)
4. A.

By symmetry, we have
$$
f(-x)=f(x-2 \pi) \text {. }
$$

Since $f(x)$ is a periodic function with a period of $2 \pi$, we have
$$
f(x)=f(x-2 \pi) \text {. }
$$

Therefore, $f(-x)=f(x)$.
Thus, $-a \sin 2 x+\cos 2 x-\sin x+\cos x$
$$
=a \sin 2 x+\cos 2 x+\sin x+\cos x \text {, }
$$

which simplifies to $\sin x(2 a \cos x+1)=0$ (for any $x \in \mathbf{R}$).
Hence, $2 a \cos x=-1$ (for any $x \neq k \pi, k \in \mathbf{Z}$).
However, the above equation cannot hold for $a=0$ or $a \neq 0$, leading to a contradiction. Therefore, $S$ must be an empty set.