rsmith added inline comments.

================
Comment at: lib/Basic/FileManager.cpp:514-519
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
+
----------------
This doesn't appear to be necessary: the identifier PATH_MAX does not appear 
later in this file.


================
Comment at: lib/Frontend/ModuleDependencyCollector.cpp:102-106
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
----------------
I think this is generally the wrong way to address this problem on Hurd:

https://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL

If `PATH_MAX` isn't defined, we should instead pass `NULL` to `realpath` (and 
deallocate the result): passing a fixed-size buffer is wrong, because we cannot 
assume that the real path will fit in 4096 bytes.

(If we neither have `PATH_MAX` defined nor a `realpath` that can accept a null 
pointer as the destination buffer, then `realpath` is unusable on that platform 
and there's nothing we can do there but return a `false` result to the caller 
of `real_path`.)


Repository:
  rC Clang

https://reviews.llvm.org/D53410



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D53410: A... Sylvestre Ledru via Phabricator via cfe-commits
    • [PATCH] D534... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to