Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for gcc and clang 7 #2484

Merged
merged 1 commit into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions app/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
#include "types.hpp"
#include "xmp_exiv2.hpp"

// + standard includes
#include <sys/stat.h> // for stat()
#include <sys/types.h> // for stat()

#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <mutex>
#include <sstream>

// + standard includes
#include <sys/stat.h> // for stat()
#include <sys/types.h> // for stat()
#ifdef EXV_HAVE_UNISTD_H
#include <unistd.h> // for stat()
#endif
Expand All @@ -46,7 +45,13 @@
} while (false)
#endif

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

// *****************************************************************************
// local declarations
Expand Down
7 changes: 6 additions & 1 deletion app/getopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@

#include <cstdio>
#include <cstring>
#include <filesystem>

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

namespace Util {
// https://raw.githubusercontent.com/skeeto/getopt/master/getopt.h
Expand Down
7 changes: 6 additions & 1 deletion samples/path-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

#include <exiv2/exiv2.hpp>

#include <filesystem>
#include <fstream>
#include <iostream>

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

int main(int argc, char* const argv[]) {
Exiv2::XmpParser::initialize();
Expand Down
7 changes: 6 additions & 1 deletion src/basicio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <cstdlib> // for alloc, realloc, free
#include <cstring> // std::memcpy
#include <ctime> // timestamp for the name of temporary file
#include <filesystem>
#include <fstream> // write the temporary file
#include <iostream>

Expand All @@ -43,7 +42,13 @@
#include <windows.h>
#endif

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

// *****************************************************************************
// class member definitions
Expand Down
18 changes: 11 additions & 7 deletions src/futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
#include <algorithm>
#include <array>
#include <cstring>
#include <filesystem>
#include <sstream>
#include <stdexcept>

#ifdef EXV_HAVE_UNISTD_H
#include <unistd.h> // for stat()
#endif

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

#if defined(_WIN32)
// clang-format off
Expand All @@ -42,7 +43,10 @@ namespace fs = std::filesystem;
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#endif

#ifdef EXV_HAVE_UNISTD_H
#include <unistd.h> // for stat()
#endif

#ifndef _MAX_PATH
Expand Down Expand Up @@ -374,7 +378,7 @@ std::string getProcessPath() {
ret = path;
}
#elif defined(__unix__)
ret = std::filesystem::read_symlink("/proc/self/exe");
ret = fs::read_symlink("/proc/self/exe");
#endif

const size_t idxLastSeparator = ret.find_last_of(EXV_SEPARATOR_CHR);
Expand Down
13 changes: 9 additions & 4 deletions src/makernote_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
#include "utils.hpp"

// + standard includes
#ifdef EXV_ENABLE_INIH
#include <INIReader.h>
#endif
#include <array>
#include <filesystem>
#include <iostream>

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

#if !defined(_WIN32)
#include <pwd.h>
Expand All @@ -33,7 +35,10 @@ namespace fs = std::filesystem;
#define CSIDL_PROFILE 40
#endif
#include <process.h>
#endif

#ifdef EXV_ENABLE_INIH
#include <INIReader.h>
#endif

// *****************************************************************************
Expand Down
8 changes: 7 additions & 1 deletion unitTests/test_ImageFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
#include <error.hpp> // Need to include this header for the Exiv2::Error exception

#include <gtest/gtest.h>

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

using namespace Exiv2;
namespace fs = std::filesystem;

TEST(TheImageFactory, createsInstancesForFewSupportedTypesInMemory) {
// Note that the constructor of these Image classes take an 'create' argument
Expand Down
7 changes: 6 additions & 1 deletion unitTests/test_futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
// Auxiliary headers
#include <cerrno>
#include <cstdio>
#include <filesystem>
#include <fstream>
#include <stdexcept>

#include <gtest/gtest.h>

#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

using namespace Exiv2;

Expand Down