Skip to content

Commit 85b76db

Browse files
committed
use _WIN32 for Windows and _MSC_VER for compiler checks
1 parent ac9fc03 commit 85b76db

10 files changed

Lines changed: 31 additions & 23 deletions

File tree

cmake/schema_scanner/schemaScanner.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222

2323
# include <string.h>
2424

25-
# if defined( _WIN32 ) || defined ( __WIN32__ )
25+
# ifdef _WIN32
2626
# include <direct.h>
2727
# define getcwd _getcwd
2828
# else

include/sc_cf_cmake.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/**** Define statements for CMake ****/
55
#cmakedefine HAVE_NDIR_H 1
6-
#cmakedefine HAVE_STDARG_H 1
6+
#cmakedefine HAVE_STDINT_H 1
77
#cmakedefine HAVE_SYS_STAT_H 1
88
#cmakedefine HAVE_SYS_PARAM_H 1
99
#cmakedefine HAVE_SYSENT_H 1
@@ -20,6 +20,7 @@
2020
#cmakedefine HAVE_MEMCPY 1
2121
#cmakedefine HAVE_MEMMOVE 1
2222
#cmakedefine HAVE_GETOPT 1
23+
#cmakedefine HAVE_VSNPRINTF 1
2324

2425
#cmakedefine HAVE_SSIZE_T 1
2526

src/base/path2str.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
*/
1212
SC_BASE_EXPORT const char * path2str_fn( const char * fileMacro );
1313

14-
#if defined( _WIN32 ) || defined ( __WIN32__ )
14+
#ifdef _WIN32
1515
# define path2str(path) path2str_fn(path)
1616
#else
1717
# define path2str(path) path
18-
#endif /* defined( _WIN32 ) || defined ( __WIN32__ ) */
18+
#endif
1919

2020
#endif /* PATH2STR_H */

src/base/sc_benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "sc_benchmark.h"
44
#include "sc_memmgr.h"
55

6-
#ifdef __WIN32__
6+
#ifdef _WIN32
77
#include <windows.h>
88
#include <psapi.h>
99
#else
@@ -49,7 +49,7 @@ benchVals getMemAndTime( ) {
4949
vals.sysMilliseconds = ( stime * 1000 ) / sysconf( _SC_CLK_TCK );
5050
#elif defined(__APPLE__)
5151
// http://stackoverflow.com/a/1911863/382458
52-
#elif defined(__WIN32__)
52+
#elif defined(_WIN32)
5353
// http://stackoverflow.com/a/282220/382458 and http://stackoverflow.com/a/64166/382458
5454
PROCESS_MEMORY_COUNTERS MemoryCntrs;
5555
FILETIME CreationTime, ExitTime, KernelTime, UserTime;

src/cleditor/STEPfile.inline.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int STEPfile::SetFileType( FileTypeCode ft ) {
8585
** from filename
8686
*/
8787
std::string STEPfile::TruncFileName( const std::string filename ) const {
88-
#if defined(__WIN32__) && !defined(__mingw32__)
88+
#if defined(_WIN32) && !defined(__mingw32__)
8989
char slash = '\\';
9090
#else
9191
char slash = '/';

src/cllazyfile/current_function.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,18 @@
2828

2929
# define SC_CURRENT_FUNCTION __PRETTY_FUNCTION__
3030

31-
#elif defined(__FUNCSIG__)
31+
#elif defined(_MSC_VER) && _MSC_VER < 1900
3232

33-
# define SC_CURRENT_FUNCTION __FUNCSIG__
33+
# define SC_CURRENT_FUNCTION __FUNCTION__
3434

3535
#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
3636

3737
# define SC_CURRENT_FUNCTION __FUNCTION__
3838

39-
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
39+
#else // STDC
4040

4141
# define SC_CURRENT_FUNCTION __func__
4242

43-
#else
44-
45-
# define SC_CURRENT_FUNCTION "(unknown)"
46-
4743
#endif
4844

4945
#endif // #ifndef CURRENT_FUNCTION_HPP_INCLUDED

src/cllazyfile/lazyTypes.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
#ifndef LAZYTYPES_H
22
#define LAZYTYPES_H
33

4+
#include "sc_cf.h"
5+
46
#include <iostream>
57
#include <vector>
68
#include <set>
9+
10+
#ifdef HAVE_STDINT_H
711
#include <stdint.h>
12+
#else
13+
#if defined(_MSC_VER) && _MSC_VER < 1600
14+
typedef unsigned __int64 uint64_t;
15+
typedef unsigned __int16 uint16_t;
16+
#endif
17+
#endif
818

919
#include "judyLArray.h"
1020
#include "judySArray.h"

src/clutils/dirobj.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@
5252

5353
#include <string>
5454
#include <iostream>
55+
#include <cstring>
5556

56-
#if defined(__WIN32__)
57+
#ifdef _WIN32
5758
#include <shlwapi.h>
5859
#endif
5960

@@ -145,7 +146,7 @@ int DirObj::Index( const char * name ) {
145146
bool DirObj::Reset( const std::string & path ) {
146147
bool successful = IsADirectory( path.c_str() );
147148
if( successful ) {
148-
#ifdef __WIN32__
149+
#ifdef _WIN32
149150
WIN32_FIND_DATA FindFileData;
150151
HANDLE hFind;
151152

@@ -182,7 +183,7 @@ bool DirObj::Reset( const std::string & path ) {
182183
///////////////////////////////////////////////////////////////////////////////
183184

184185
bool DirObj::IsADirectory( const char * path ) {
185-
#if defined(__WIN32__)
186+
#ifdef _WIN32
186187
if( PathIsDirectory( path ) ) {
187188
return true;
188189
}
@@ -217,7 +218,7 @@ bool DirObj::IsADirectory( const char * path ) {
217218
std::string DirObj::Normalize( const std::string & path ) {
218219
std::string buf;
219220
const char * slash;
220-
#if defined(__WIN32__)
221+
#ifdef _WIN32
221222
char b[MAX_PATH];
222223
PathCanonicalize( b, path.c_str() );
223224
slash = "\\";
@@ -231,7 +232,7 @@ std::string DirObj::Normalize( const std::string & path ) {
231232
} else {
232233
buf.assign( b );
233234

234-
#if !defined(__WIN32__)
235+
#if !defined(_WIN32)
235236
free(b);
236237
#endif
237238
}
@@ -254,7 +255,7 @@ std::string DirObj::Normalize( const std::string & path ) {
254255
///////////////////////////////////////////////////////////////////////////////
255256

256257
const char * DirObj::ValidDirectories( const char * path ) {
257-
#ifdef __WIN32__
258+
#ifdef _WIN32
258259
static char buf[MAX_PATH + 1];
259260
#else
260261
static char buf[MAXPATHLEN + 1];
@@ -308,7 +309,7 @@ void DirObj::InsertFile( const char * f, int index ) {
308309
CheckIndex( index );
309310
spot = &fileList[index];
310311
}
311-
#ifdef __MSVC__
312+
#ifdef _MSC_VER
312313
char * string = _strdup( f );
313314
#else
314315
char * string = strdup( f );

src/exppp/pretty_schema.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "pretty_scope.h"
1515
#include "pretty_schema.h"
1616

17-
#if defined( _WIN32 ) || defined ( __WIN32__ )
17+
#ifdef _WIN32
1818
# define unlink _unlink
1919
#else
2020
# include <unistd.h> /* for unlink */

test/cpp/schema_specific/stepfile_rw_progress.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#ifdef HAVE_STD_CHRONO
3232
# define DELAY(t) std::this_thread::sleep_for(std::chrono::milliseconds(t));
3333
#else
34-
# ifndef __WIN32__
34+
# ifndef _WIN32
3535
# define DELAY(t) usleep( t * 100 )
3636
# else
3737
# include <WinBase.h>

0 commit comments

Comments
 (0)