Upvote:1
Based on your itinerary home->HK->Macau->Shanghai->home
Your China visa is only needed when you enter the mainland, which does not include Macau or Hong Kong. Although they are both officially part of "China" they are treated almost as separate countries for immigration and customs purposes. The border is called a "boundary" but you will find immigration and customs people there.
So when you land in HK you will be subject to HK immigration law, and will get a stamp in your passport (assuming you don't take one of the ferries that leaves without going through immigration in HK), then you will exit HK (surrendering your departure card) and go through Macau immmigration- another entry card, and another stamp. Then when you leave Macau and enter China, presumably at Zhuhai, you will exit again and only now will your China visa will come into play.
So, in short, your single entry China visa is fine for this itinerary.