Skip to content

Commit

Permalink
Merge pull request #1421 from s-trinh/fix_WIN32_macro_usage
Browse files Browse the repository at this point in the history
Fix WIN32 macro usages in simdlib
  • Loading branch information
fspindle authored Jun 26, 2024
2 parents a8a9dc1 + 92a253f commit 503f563
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/simdlib/Simd/SimdAlignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Simd

SIMD_INLINE size_t Alignment()
{
#if defined(WIN32)
#if defined(_WIN32)
return GetAlignment();
#else
return ALIGNMENT;
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/simdlib/Simd/SimdAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace Simd
*/
static SIMD_INLINE size_t Alignment()
{
#if defined(__SimdAlignment_h__) && defined(WIN32)
#if defined(__SimdAlignment_h__) && defined(_WIN32)
return Simd::Alignment();
#else
return SimdAlignment();
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/simdlib/Simd/SimdBaseCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <sstream>
#include <iostream>

#if defined(_MSC_VER)
#if defined(_WIN32)

#ifndef NOMINMAX
#define NOMINMAX
Expand Down Expand Up @@ -77,7 +77,7 @@ namespace Simd {
#if defined(SIMD_X86_ENABLE) || defined(SIMD_X64_ENABLE)
bool CheckBit(int eax, int ecx, Cpuid::Register index, Cpuid::Bit bit) {
unsigned int registers[4] = { 0, 0, 0, 0 };
#if defined(_MSC_VER)
#if defined(_WIN32)
__cpuidex((int*)registers, eax, ecx);
#elif (defined __GNUC__)
if (__get_cpuid_max(0, NULL) < eax)
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace Simd {
}
#endif

#if defined(_MSC_VER)
#if defined(_WIN32)
typedef SYSTEM_LOGICAL_PROCESSOR_INFORMATION Info;

void GetLogicalProcessorInformation(std::vector<Info>& info) {
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/simdlib/Simd/SimdLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define SIMD_LIB_CPP
#endif

#if defined(WIN32) && !defined(SIMD_STATIC)
#if defined(_WIN32) && !defined(SIMD_STATIC)

#define SIMD_EXPORTS
#ifndef NOMINMAX
Expand All @@ -50,7 +50,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
}
return TRUE;
}
#endif//WIN32
#endif//_WIN32

#include "Simd/SimdLib.h"

Expand Down
6 changes: 3 additions & 3 deletions modules/core/include/visp3/core/vpSerial.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -31,8 +31,8 @@
* Serial communication.
*/

#ifndef _vpSerial_h_
#define _vpSerial_h_
#ifndef VP_SERIAL_H
#define VP_SERIAL_H

#if !defined(_WIN32)

Expand Down
10 changes: 4 additions & 6 deletions modules/core/src/tools/serial/vpSerial.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -30,8 +29,7 @@
*
* Description:
* Serial communication.
*
*****************************************************************************/
*/

#include <visp3/core/vpConfig.h>

Expand Down Expand Up @@ -100,7 +98,7 @@ BEGIN_VISP_NAMESPACE
\param[in] bytesize : Size of each byte in the serial transmission of data. Default is 8 bits.
\param[in] parity : Parity parameter. Default is without parity check.
\param[in] stopbits : Number of stop bits used. Default is 1 stop bit.
\param[in] flowcontrol : Type of flowcontrol used. Default is no flow control.
\param[in] flowcontrol : Type of flow control used. Default is no flow control.
*/
vpSerial::vpSerial(const std::string &port, unsigned long baudrate, bytesize_t bytesize, parity_t parity,
Expand Down Expand Up @@ -223,7 +221,7 @@ void vpSerial::close()
int main()
{
#ifndef WIN32
#ifndef _WIN32
vpSerial serial;
serial.setPort("/dev/ttyUSB0");
Expand Down
2 changes: 1 addition & 1 deletion modules/core/test/math/testMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
// 4723 : potential divide by 0
#endif

#ifdef WIN32
#ifdef _WIN32
#ifndef NAN
// https://msdn.microsoft.com/en-us/library/w22adx1s%28v=vs.120%29.aspx
// http://tdistler.com/2011/03/24/how-to-define-nan-not-a-number-on-windows
Expand Down
6 changes: 3 additions & 3 deletions modules/robot/src/real-robot/flir-ptu/vpRobotFlirPtu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void vpRobotFlirPtu::emergencyStop(int signo)
case SIGSEGV:
msg << "SIGSEGV (stop due to a segmentation fault) ";
break;
#ifndef WIN32
#ifndef _WIN32
case SIGBUS:
msg << "SIGBUS (stop due to a bus error) ";
break;
Expand Down Expand Up @@ -113,7 +113,7 @@ vpRobotFlirPtu::vpRobotFlirPtu()
{
signal(SIGINT, vpRobotFlirPtu::emergencyStop);
signal(SIGSEGV, vpRobotFlirPtu::emergencyStop);
#ifndef WIN32
#ifndef _WIN32
signal(SIGBUS, vpRobotFlirPtu::emergencyStop);
signal(SIGKILL, vpRobotFlirPtu::emergencyStop);
signal(SIGQUIT, vpRobotFlirPtu::emergencyStop);
Expand Down Expand Up @@ -547,7 +547,7 @@ void vpRobotFlirPtu::connect(const std::string &portname, int baudrate)

// Open a port
if (ceropen(m_cer, portname.c_str(), 0)) {
#if WIN32
#if _WIN32
throw(vpException(vpException::fatalError, "Failed to open %s: %s.", portname.c_str(),
cerstrerror(m_cer, errstr, sizeof(errstr))));
#else
Expand Down

0 comments on commit 503f563

Please sign in to comment.