Skip to content

Prevent source location in release build #1259

Closed

Description

#1185 added source information to the exception using C++20 (#ifdef __cpp_lib_source_location). Now, it may not be desirable to have source file paths strings included in release builds.

Can a facility be added which allows a user to control whether winrt adds source location to the exception?

Maybe through a new configuration define? e.g.
#define WINRT_NO_SOURCE_LOCATION

Activity

  1. kennykerr commented on Jan 5, 2023

    @kennykerr
    Collaborator

    Adding David Machaj (@dmachaj) for comment.

  2. dmachaj commented on Jan 5, 2023

    @dmachaj
    Contributor

    That is a reasonable request and would probably not be difficult to add.

    Out of curiosity what is your reason for wanting to suppress this information? Are you concerned about binary size? Or leaking source code information publicly? Or some other reason entirely? That doesn't change the reasonableness of the request but I am curious.

    Also, do you have any thoughts on debug vs. release for including this information? Would you still want debug builds to include this?

  3. sylveon commented on Jan 5, 2023

    @sylveon
    Contributor

    I still want this information in my release builds, so automatically disabling them in release should be avoided

  4. dmachaj commented on Jan 5, 2023

    @dmachaj
    Contributor

    Charles Milette (@sylveon) I agree with that. The default should be enabled and there is a define to disable it.

    My previous question was unclear and not fully thought-through. What I meant was whether the "disable this feature" define should be respected in debug builds. After thinking about it more that probably doesn't make sense. If someone wants this disabled then it should be disabled. If they want it only for debug builds then they can just add or remove the define as appropriate.

  5. matbech commented on Jan 5, 2023

    @matbech
    ContributorAuthor

    David Machaj (@dmachaj) Primary for privacy reasons (the source tree structure shouldn't be public). In addition, it might also be interesting for reproducible builds.

  6. sylveon commented on Jan 5, 2023

    @sylveon
    Contributor

    In regards to reproducible builds, /d1trimfile also affects std::source_location

  7. dmachaj commented on Jan 5, 2023

    @dmachaj
    Contributor

    /d1trimfile is probably worth looking into regardless, if you want reproducible builds. It will strip out the parts of the path prior to the root of your repo so it is consistent regardless of the directory structure above it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions