The Gemara in Masechet Eruvin (104a) tells us that our Sages banned producing sound on Shabbat and Yom Tov, for instance, by playing a musical instrument, for they were concerned that while the tune is being played, the player will come to fix the instrument.
This decree would certainly apply even nowadays, for it is quite common for musicians to tune their instruments and were they to be playing the instruments on Shabbat or Yom Tov, they would transgress the prohibition of fixing the instruments in their hands which can sometimes constitute a Torah prohibition. (Even if the edict would not apply nowadays, we would nevertheless follow the rule regarding all rabbinic enactments that even if the reason for the decree no longer applies, the edict still stands.)
Nevertheless, our Sages only banned producing musical sounds which do not result from singing, such as banging on a drum, blowing a Shofar (except for Mitzvah usage on the holiday of Rosh Hashanah), and the like; however, musical sound produced by singing is not prohibited on Shabbat and Yom Tov. On the contrary, it is actually a Mitzvah to sing the praises of Hashem in honor of Shabbat and Yom Tov.
Regarding whistling on Shabbat, if this is being done with the use of a whistle or other such instruments, this is clearly forbidden, for this constitutes production of the forbidden kind of musical sound completely banned by our Sages. Regarding whistling by mouth, however, the Rama writes (in the beginning of Chapter 338) that those who call their friends by means of whistling or chirping may indeed do so on Shabbat. The Magen Avraham adds that even if one whistles a proper tune, this is not forbidden since this is like any other singing by mouth which is permissible on Shabbat.
Indeed, many other Acharonim rule likewise. Although Hagaon Chida writes in his Sefer Birkei Yosef (Shiyurei Beracha, Chapter 338) in the name of Rabbeinu Pinchas Anav that whistling a tune on Shabbat is forbidden, nevertheless, Maran Ha’Chida himself in his Machazik Beracha (ibid.) writes that based on the above ruling of the Rama, it has become customary in the lands of Germany and Poland to whistle tunes on Shabbat, the likes of which almost resemble actual musical instruments. Maran Rabbeinu Ovadia Yosef zt”l writes that this is indeed the correct ruling on this matter.
Thus, halachically speaking, although it is forbidden to blow a whistle or similar instrument on Shabbat, it is nevertheless permissible to whistle by mouth on Shabbat.