summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/Directory.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-18 15:16:42 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-12-18 15:16:42 (GMT)
commitcd7bde80bf3c3e141a92058ad033833066da509b (patch)
tree009ef0b56f2f3e5d6bb7acfb0cb56cdd02651831 /Source/kwsys/Directory.cxx
parent45b1e31451dc9e393703380282434a2456284954 (diff)
parent3470704f5a68310a063d928e290a41be5e49620f (diff)
downloadCMake-cd7bde80bf3c3e141a92058ad033833066da509b.zip
CMake-cd7bde80bf3c3e141a92058ad033833066da509b.tar.gz
CMake-cd7bde80bf3c3e141a92058ad033833066da509b.tar.bz2
Merge topic 'update-kwsys'
3470704f Merge branch 'upstream-kwsys' into update-kwsys 6a5ab894 KWSys 2014-12-16 (cc4046a8)
Diffstat (limited to 'Source/kwsys/Directory.cxx')
-rw-r--r--Source/kwsys/Directory.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 741bcba..04b2866 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -203,13 +203,18 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
#include <sys/types.h>
#include <dirent.h>
-/* There is a problem with the Portland compiler, large file
-support and glibc/Linux system headers:
-http://www.pgroup.com/userforum/viewtopic.php?
-p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
-*/
-#if defined(__PGI) && defined(__USE_FILE_OFFSET64)
-# define dirent dirent64
+// PGI with glibc has trouble with dirent and large file support:
+// http://www.pgroup.com/userforum/viewtopic.php?
+// p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
+// Work around the problem by mapping dirent the same way as readdir.
+#if defined(__PGI) && defined(__GLIBC__)
+# define kwsys_dirent_readdir dirent
+# define kwsys_dirent_readdir64 dirent64
+# define kwsys_dirent kwsys_dirent_lookup(readdir)
+# define kwsys_dirent_lookup(x) kwsys_dirent_lookup_delay(x)
+# define kwsys_dirent_lookup_delay(x) kwsys_dirent_##x
+#else
+# define kwsys_dirent dirent
#endif
namespace KWSYS_NAMESPACE
@@ -226,7 +231,7 @@ bool Directory::Load(const kwsys_stl::string& name)
return 0;
}
- for (dirent* d = readdir(dir); d; d = readdir(dir) )
+ for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) )
{
this->Internal->Files.push_back(d->d_name);
}
@@ -240,7 +245,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
DIR* dir = opendir(name.c_str());
unsigned long count = 0;
- for (dirent* d = readdir(dir); d; d = readdir(dir) )
+ for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) )
{
count++;
}