[llvm-commits] [llvm] r51218 - /llvm/trunk/include/llvm/System/Path.h

Zhongxing Xu mymlreader at gmail.com
Sun May 18 00:27:44 PDT 2008


This make compiling fails on Fedora 9 GCC 4.3.
It says 'strcmp' was not declared in this scope.
Should also include <cstring>.

On Sat, May 17, 2008 at 5:10 PM, Bill Wendling <isanbard at gmail.com> wrote:

> Author: void
> Date: Sat May 17 04:10:40 2008
> New Revision: 51218
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51218&view=rev
> Log:
> On Darwin, the string header file isn't 64-bit clean. The use of
> "-Wshorten-64-to-32 -Werror" will cause a failure when compiling this
> complex
> program:
>
> #include <string>
>
> class Path {
>  mutable std::string path;
> public:
>  bool operator == (const Path &that) {
>    return path == that.path;
>  }
> };
>
> Using strcmp gets us past this annoying error.
>
> Modified:
>    llvm/trunk/include/llvm/System/Path.h
>
> Modified: llvm/trunk/include/llvm/System/Path.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=51218&r1=51217&r2=51218&view=diff
>
>
> ==============================================================================
> --- llvm/trunk/include/llvm/System/Path.h (original)
> +++ llvm/trunk/include/llvm/System/Path.h Sat May 17 04:10:40 2008
> @@ -206,14 +206,14 @@
>       /// @returns true if \p this and \p that refer to the same thing.
>       /// @brief Equality Operator
>       bool operator==(const Path &that) const {
> -        return path == that.path;
> +        return strcmp(path.c_str(), that.path.c_str()) == 0;
>       }
>
>       /// Compares \p this Path with \p that Path for inequality.
>       /// @returns true if \p this and \p that refer to different things.
>       /// @brief Inequality Operator
>       bool operator!=(const Path &that) const {
> -        return path != that.path;
> +        return strcmp(path.c_str(), that.path.c_str()) != 0;
>       }
>
>       /// Determines if \p this Path is less than \p that Path. This is
> required
> @@ -223,7 +223,7 @@
>       /// @returns true if \p this path is lexicographically less than \p
> that.
>       /// @brief Less Than Operator
>       bool operator<(const Path& that) const {
> -        return path < that.path;
> +        return strcmp(path.c_str(), that.path.c_str()) < 0;
>       }
>
>     /// @}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080518/f4a57fae/attachment.html>


More information about the llvm-commits mailing list