Skip to content

Commit bd30ca0

Browse files
committed
Replace #ifdef __linux__ by guards allowing more Unices
We require the Unix fork() system call (in unistd.h)
1 parent 68a0b7b commit bd30ca0

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

src/memory-analyzer/gdb_api.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Author: Malte Mues <[email protected]>
1010
/// \file
1111
/// Low-level interface to gdb
1212

13-
#ifdef __linux__
13+
// clang-format off
14+
#if defined(__linux__) || \
15+
defined(__FreeBSD_kernel__) || \
16+
defined(__GNU__) || \
17+
defined(__unix__) || \
18+
defined(__CYGWIN__) || \
19+
defined(__MACH__)
20+
// clang-format on
21+
1422
#include <cctype>
1523
#include <cerrno>
1624
#include <cstdio>

src/memory-analyzer/gdb_api.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ Author: Malte Mues <[email protected]>
1515
/// gdb machine interface (see section "The GDB/MI Interface" in the
1616
/// gdb manual to communicate with gdb.
1717

18-
#ifdef __linux__
18+
// clang-format off
19+
#if defined(__linux__) || \
20+
defined(__FreeBSD_kernel__) || \
21+
defined(__GNU__) || \
22+
defined(__unix__) || \
23+
defined(__CYGWIN__) || \
24+
defined(__MACH__)
25+
// clang-format on
26+
1927
#ifndef CPROVER_MEMORY_ANALYZER_GDB_API_H
2028
#define CPROVER_MEMORY_ANALYZER_GDB_API_H
2129
#include <unistd.h>
@@ -92,4 +100,4 @@ class gdb_interaction_exceptiont : public cprover_exception_baset
92100
};
93101

94102
#endif // CPROVER_MEMORY_ANALYZER_GDB_API_H
95-
#endif // __linux__
103+
#endif

unit/memory-analyzer/gdb_api.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@ Author: Malte Mues <[email protected]>
99

1010
#include <testing-utils/use_catch.h>
1111

12-
#ifdef __linux__
13-
// \file Test that the regex expression used work as expected.
14-
#define private public
12+
// clang-format off
13+
#if defined(__linux__) || \
14+
defined(__FreeBSD_kernel__) || \
15+
defined(__GNU__) || \
16+
defined(__unix__) || \
17+
defined(__CYGWIN__) || \
18+
defined(__MACH__)
19+
// clang-format on
20+
21+
#include <cstdio>
22+
#include <cstdlib>
23+
#include <regex>
24+
#include <string>
25+
26+
#include <fstream>
27+
#include <iostream>
28+
1529
#include <memory-analyzer/gdb_api.cpp>
1630
#include <string>
1731

0 commit comments

Comments
 (0)