[llvm-dev] [llvm-rc] absolute.test failing

Liam Reimers via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 9 15:20:37 PST 2019

I believe Windows uses slashes instead of hyphens for command line args.


> On Jan 9, 2019, at 2:03 PM, David Greene via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> I've come across a curious and pernicious problem in llvm-rc.
> absolute.test checks that llvm-rc can accept a filename that is an
> absolute path.  And it works just fine.  Until you run it with a file
> that starts with "/c."
> These will fail:
> llvm-rc /crawl/through/some/path/to/my.rc
> llvm-rc /c/some/path/to/my.rc
> The option parser ends up interpreting "/" as an option prefix and then
> the parser matches it to this in tools/llvm-rc/Opts.td:
> def CODEPAGE : JoinedOrSeparate<[ "/", "-" ], "C">,
>               HelpText<"Set the codepage used for input strings.">;
> The test then fails with:
>  Exactly one input file should be provided.
> The same problem happens with files that begin with "/r"
> (/read/the/path/to/my.rc) "/sl" (/slink/along/the/path/to/my.rc) or any
> other path that happens to begin with the same text as an option in
> Opts.td.
> This triggered on one of our builders that just happens to build to a
> path that begins with "/c."  Presumably none of the existing Buildbots
> build to paths that cause problems.
> It's easy enough to construct a test for this, but I'm not sure how/if
> llvm-rc should be fixed.  I don't know why it accepts both "/" and "-"
> as option prefixes.  As this mostly seems related to Windows (resource
> files), should tests be UNSUPPORTED on every other platform?  Or is
> llvm-rc intended to be a cross-platform way to create resource files?
> If the latter, then it seems like options ought to use the "/" prefix on
> Windows and "-" everywhere else so as not to conflict with path
> specifiers.
>                             -David
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list