Compiler flag to put all symbols in a namespace

61 views
Skip to first unread message

dru...@chromium.org

unread,
Jan 7, 2019, 2:01:41 PM1/7/19
to Chromium-dev
I noticed third_party/unrar/src defines all of its symbols in the global namespace, which is not ideal. Is there an easy way to put all of these symbols into a namespace? I'm hoping for some sort of compiler flags/configuration, rather than just going through each file and adding a namespace declaration, since the latter makes it hard to pull in new versions of unrar.

Mostyn Bramley-Moore

unread,
Jan 8, 2019, 2:21:50 PM1/8/19
to dru...@chromium.org, Chromium-dev
We looked for ways to do things like this in order to make it easier to build more code in jumbo mode, and came up empty handed.  So I don't think there's a good way to do what you want.  

You could experiment with symbol renaming or prefixing with objcopy, but I think this would require that you maintain a separate header file with the mangled names for client code to use.  I have seen this used in some C libraries, but it makes debugging difficult, and I suspect this would be more difficult to do with C++ symbols.  I doubt this would work well.

-Mostyn.

On Mon, Jan 7, 2019 at 8:01 PM <dru...@chromium.org> wrote:
I noticed third_party/unrar/src defines all of its symbols in the global namespace, which is not ideal. Is there an easy way to put all of these symbols into a namespace? I'm hoping for some sort of compiler flags/configuration, rather than just going through each file and adding a namespace declaration, since the latter makes it hard to pull in new versions of unrar.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/7f4eb5f2-39cb-47c8-b337-da3ba87e9757%40chromium.org.


--
Mostyn Bramley-Moore
Vewd Software
Reply all
Reply to author
Forward
0 new messages