Replaced __linux macro with __linux__

This commit is contained in:
Vojtech Bubnik 2021-01-11 13:31:30 +01:00
parent 7a1574a853
commit 7d751753bc
6 changed files with 9 additions and 9 deletions

View File

@ -134,7 +134,7 @@ GCodeSender::set_baud_rate(unsigned int baud_rate)
speed_t newSpeed = baud_rate; speed_t newSpeed = baud_rate;
ioctl(handle, IOSSIOSPEED, &newSpeed); ioctl(handle, IOSSIOSPEED, &newSpeed);
::tcsetattr(handle, TCSANOW, &ios); ::tcsetattr(handle, TCSANOW, &ios);
#elif __linux #elif __linux__
termios2 ios; termios2 ios;
if (ioctl(handle, TCGETS2, &ios)) if (ioctl(handle, TCGETS2, &ios))
printf("Error in TCGETS2: %s\n", strerror(errno)); printf("Error in TCGETS2: %s\n", strerror(errno));

View File

@ -39,9 +39,9 @@
#include <tbb/task_scheduler_init.h> #include <tbb/task_scheduler_init.h>
#if defined(__linux) || defined(__GNUC__ ) #if defined(__linux__) || defined(__GNUC__ )
#include <strings.h> #include <strings.h>
#endif /* __linux */ #endif /* __linux__ */
#ifdef _MSC_VER #ifdef _MSC_VER
#define strcasecmp _stricmp #define strcasecmp _stricmp

View File

@ -257,7 +257,7 @@ bool instance_check(int argc, char** argv, bool app_config_single_instance)
hashed_path = std::hash<std::string>{}(boost::filesystem::system_complete(argv[0]).string()); hashed_path = std::hash<std::string>{}(boost::filesystem::system_complete(argv[0]).string());
#else #else
boost::system::error_code ec; boost::system::error_code ec;
#ifdef __linux #ifdef __linux__
// If executed by an AppImage, start the AppImage, not the main process. // If executed by an AppImage, start the AppImage, not the main process.
// see https://docs.appimage.org/packaging-guide/environment-variables.html#id2 // see https://docs.appimage.org/packaging-guide/environment-variables.html#id2
const char *appimage_env = std::getenv("APPIMAGE"); const char *appimage_env = std::getenv("APPIMAGE");
@ -275,7 +275,7 @@ bool instance_check(int argc, char** argv, bool app_config_single_instance)
BOOST_LOG_TRIVIAL(error) << "APPIMAGE environment variable was set, but it does not point to a valid file: " << appimage_env; BOOST_LOG_TRIVIAL(error) << "APPIMAGE environment variable was set, but it does not point to a valid file: " << appimage_env;
} }
if (! appimage_env_valid) if (! appimage_env_valid)
#endif // __linux #endif // __linux__
hashed_path = std::hash<std::string>{}(boost::filesystem::canonical(boost::filesystem::system_complete(argv[0]), ec).string()); hashed_path = std::hash<std::string>{}(boost::filesystem::canonical(boost::filesystem::system_complete(argv[0]), ec).string());
if (ec.value() > 0) { // canonical was not able to find the executable (can happen with appimage on some systems. Does it fail on Fuse file systems?) if (ec.value() > 0) { // canonical was not able to find the executable (can happen with appimage on some systems. Does it fail on Fuse file systems?)
ec.clear(); ec.clear();

View File

@ -93,7 +93,7 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance
{ {
std::vector<const char*> args; std::vector<const char*> args;
args.reserve(3); args.reserve(3);
#ifdef __linux #ifdef __linux__
static const char* gcodeviewer_param = "--gcodeviewer"; static const char* gcodeviewer_param = "--gcodeviewer";
{ {
// If executed by an AppImage, start the AppImage, not the main process. // If executed by an AppImage, start the AppImage, not the main process.
@ -105,7 +105,7 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance
args.emplace_back(gcodeviewer_param); args.emplace_back(gcodeviewer_param);
} }
} }
#endif // __linux #endif // __linux__
std::string my_path; std::string my_path;
if (args.empty()) { if (args.empty()) {
// Binary path was not set to the AppImage in the Linux specific block above, call the application directly. // Binary path was not set to the AppImage in the Linux specific block above, call the application directly.

View File

@ -313,7 +313,7 @@ void Serial::set_baud_rate(unsigned baud_rate)
speed_t newSpeed = baud_rate; speed_t newSpeed = baud_rate;
handle_errno(::ioctl(handle, IOSSIOSPEED, &newSpeed)); handle_errno(::ioctl(handle, IOSSIOSPEED, &newSpeed));
handle_errno(::tcsetattr(handle, TCSANOW, &ios)); handle_errno(::tcsetattr(handle, TCSANOW, &ios));
#elif __linux #elif __linux__
/* The following definitions are kindly borrowed from: /* The following definitions are kindly borrowed from:
/usr/include/asm-generic/termbits.h /usr/include/asm-generic/termbits.h