TeX displays such warnings when the badness is above a threshold contained in the parameters
\vbadness. You're interested in the first one:
Since the badness can never be above 10000, this effectively suppresses all
Underfull \hbox messages. There might still be
Overfull \hbox messages, which are suppressed by adding
\hfuzz=\maxdimen inside the
If the constructed box is used only for measuring it, these actions can be justified. Since the change to the parameters happens in a group, the values will automatically be restored at the end.