Are you sure that this is incorrect? It seems right to me.
My understanding is that EXTERNAL means that NAME is a function that is defined elsewhere so there is no point in declaring it unless it is used.

I cannot see any reason why an EXTERNAL has to be used inside the MODULE. The variables DD and NN are not used as well.
From my understanding a module can be used as well just for declaration without any use.
MODULE DemoB does not produce a warning; MODULE DemoC does.