The US did not warn Japan in any meaningful (or actionable) way that they would use an atomic bomb, nor did they make any effort to warn the populations of the target cities about their impending destruction.
This was deliberate — it was felt that a warning would lessen the psychological effect of the bombing, and would endanger the missions themselves (i.e., would make it possible for the Japanese to try and shoot down the planes carrying the bombs).
The US did engage in various forms of psychological warfare that were meant to look like "warnings" for conventional bombings, but they were also not actionable (they were meant to reduce morale and perhaps encourage abandonment of jobs, but were not really designed to save lives).
I've written at length about these things here, including a debunking of the (stubbornly persistent Internet) myth that the US did warn Japan about Hiroshima and Nagasaki.
On July 26, 1945; US President Harry S Truman, UK Prime Minister Winston Churchill, and President of China Chiang Kai Shek issued what has been known as the Potsdam Declaration, an ultimatum and warning to the Japanese government.
The declaration called for the armed forces of Japan to lay down all arms and the government of Japan to dismantle its war industry and open the path for a peaceful post war integration with the rest of the world. It made no mention of disposal of the Emperor.
The declaration itself did not specifically mention any atomic bombs, it warned Japan would face "the full application of military power, backed by our resolve, will mean the inevitable and complete destruction of the Japanese armed forces and just as inevitably the utter devastation of the Japanese homeland."
It is important to remember that by July 1945; Japan had been subjected to an aerial bombardment campaign that was every bit as devastating as the bombing of Nazi Germany, arguably more so. Operation Meetinghouse for example burned over 16 sq. miles of Tokyo and possibly killed over 100,000 people, which if true would make it the deadliest air raid of all time. This was one of several such raids on multiple large Japanese cities such as Osaka, Nagoya, Kobe just to name a few of the dozens and dozens. It can safely be assumed that these attacks would continue the longer the war went on, however there was never an announcement prior to missions as to which cities were to be targeted, only the bomber crews and their command knew that.
So back to the original question; yes; the Allied governments made it clear that no Japanese town or city was safe from destruction, including Hiroshima and Nagasaki. However; no specific mention of atomic bombs was made to the Japanese government prior to bombing Hiroshima.
One thing the Americans did do however was drop leaflets over Japanese cities which had not been bombed yet, warning residents to evacuate the area. More leaflets were also dropped on Nagasaki after Hiroshima had been bombed on Aug 6 which specifically outlined the power of atomic bombs, and called for civilians to leave. Several Japanese recalled how ironic it was that the enemy who had been destroying their country seemed more concerned with the well being of Japanese citizens than their own government did.
After Hiroshima was destroyed, the existence of the atomic bomb was confirmed by US President Harry S Truman who issued a statement following the attack: "We are now prepared to obliterate more rapidly and completely every productive enterprise the Japanese have above ground in any city. We shall destroy their docks, their factories, and their communications. Let there be no mistake; we shall completely destroy Japan’s power to make war."
"It was to spare the Japanese people from utter destruction that the ultimatum of July 26 was issued at Potsdam. Their leaders promptly rejected that ultimatum. If they do not now accept our terms they may expect a rain of ruin from the air, the like of which has never been seen on this earth. Behind this air attack will follow sea and land forces in such numbers and power as they have not yet seen and with the fighting skill of which they are already well aware."
So to wrap up, the Allies made it clear that any Japanese city was open season for destruction including Hiroshima and Nagasaki, but information about the atomic bomb had been withheld until it had been used. Nor was it announced that either specific city was to be attacked.
Downfall: The End of the Japanese Empire by Richard Frank; 2001.
Twilight of the Gods: War in the Western Pacific 1944-1945 (Vol.3) by Ian W. Toll; 2020.