Even an exogenously expressed non-human protein still has a "function". even if you force it to be expressed. We may not understand its effects, but it is certainly doing something. Even just taking up a space is a biological function, which an exogenously expressed protein is doing. The same applies to genes that do not get translated to protein, by definition of "doing something" they have a function.
Your viral integration example is actually a perfect example of one where all genes indeed do a have a function, but they are not readily apparent to us. Genes that control latency may not expressed until specific conditions, and that is their function, to control expression. Some genes control integration.
I spent 5 years of my life doing my PhD studying viral replication, and the "unknown function of viral genes" was a constant topic of discussion, but we all agreed, they have a function.
You're conflating "consequences and effects" with "function". The former is things that happen due to the physics, the latter is about intent or utility.
"Taking up space in the genome is a function" is a great example of this. While I'm sure you can find examples of "spacers that when deleted are fatal", the fitness effect of protein-coding regions that contain no utility is still an area of research. To me, functionality requires selection, although that's probably not necessary or sufficient!
Your viral integration example is actually a perfect example of one where all genes indeed do a have a function, but they are not readily apparent to us. Genes that control latency may not expressed until specific conditions, and that is their function, to control expression. Some genes control integration.
I spent 5 years of my life doing my PhD studying viral replication, and the "unknown function of viral genes" was a constant topic of discussion, but we all agreed, they have a function.