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.