Skip to content

Commit

Permalink
fix C++17 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausT committed Dec 15, 2020
1 parent 2f57a72 commit 7b85c65
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 45 deletions.
5 changes: 2 additions & 3 deletions Sia/sia.cpp
Expand Up @@ -28,11 +28,10 @@
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#include "miner.h"
#include "cuda_helper.h"
#include <cstdio>
using namespace std;
#include <cuda_profiler_api.h>
#include "miner.h"
#include "cuda_helper.h"
#include "sia.h"

extern void applog_hex(void *data, int len);
Expand Down
3 changes: 1 addition & 2 deletions api.cpp
Expand Up @@ -26,11 +26,9 @@
#include <cmath>
#include <cstdarg>
#include <cassert>
using namespace std;
#include <sys/stat.h>
#include <sys/types.h>

#include "miner.h"
#include "nvml.h"

#ifndef WIN32
Expand All @@ -54,6 +52,7 @@ using namespace std;
# define CLOSESOCKET closesocket
# define in_addr_t uint32_t
#endif
#include "miner.h"

#define GROUP(g) (toupper(g))
#define PRIVGROUP GROUP('W')
Expand Down
10 changes: 5 additions & 5 deletions ccminer.cpp
Expand Up @@ -52,17 +52,12 @@
BOOL WINAPI ConsoleHandler(DWORD);
#endif

using namespace std;
#include "miner.h"

#define PROGRAM_NAME "ccminer"
#define LP_SCANTIME 25
#define MNR_BLKHDR_SZ 80

double expectedblocktime(const uint32_t *target);

extern void get_cuda_arch(int *version);
extern int cuda_arch[MAX_GPUS];

// from cuda.cpp
int cuda_num_devices();
Expand All @@ -78,6 +73,11 @@ void cuda_reset_device(int thr_id, bool *init);
nvml_handle *hnvml = NULL;
#endif

#include "miner.h"

extern void get_cuda_arch(int* version);
extern int cuda_arch[MAX_GPUS];

enum workio_commands
{
WC_GET_WORK,
Expand Down
4 changes: 1 addition & 3 deletions cuda.cpp
Expand Up @@ -2,7 +2,6 @@
#include <memory.h>
#include <cstring>
#include <map>
using namespace std;
#ifndef _WIN32
#include <unistd.h>
#endif
Expand All @@ -17,9 +16,8 @@ using namespace std;
#endif

#include "nvml.h"
#include "miner.h"

#include "cuda_runtime.h"
#include "miner.h"

cudaDeviceProp device_props[MAX_GPUS];
cudaStream_t gpustream[MAX_GPUS] = { 0 };
Expand Down
9 changes: 3 additions & 6 deletions fuguecoin.cpp
@@ -1,15 +1,12 @@
#include <string.h>
#ifdef __cplusplus
#include <cstdint>
#else
#include <stdint.h>
#endif

#include "sph/sph_fugue.h"
#include <cuda_runtime.h>

#include "sph/sph_fugue.h"
#include "miner.h"
#include "cuda_fugue256.h"
#include <cuda_runtime.h>

extern bool stop_mining;
extern volatile bool mining_has_stopped[MAX_GPUS];

Expand Down
4 changes: 2 additions & 2 deletions groestlcoin.cpp
Expand Up @@ -6,13 +6,13 @@
#include <stdint.h>
#endif
#include <openssl/sha.h>
#include <cuda.h>
#include <cuda_runtime.h>

#include "sph/sph_groestl.h"
#include "cuda_groestlcoin.h"

#include "miner.h"
#include <cuda.h>
#include <cuda_runtime.h>
extern bool stop_mining;
extern volatile bool mining_has_stopped[MAX_GPUS];

Expand Down
16 changes: 9 additions & 7 deletions miner.h
@@ -1,19 +1,12 @@
#ifndef __MINER_H__
#define __MINER_H__

#ifndef WIN32
#include "ccminer-config.h"
#else
#include "ccminer-config-win.h"
#endif

#ifdef __cplusplus
#include <algorithm>
#include <cstring>
#include <cinttypes>
#include <cstdlib>
#include <cstddef>
using namespace std;
#else
#include <string.h>
#include <stdbool.h>
Expand All @@ -27,6 +20,12 @@ using namespace std;
#include <jansson.h>
#include <curl/curl.h>

#ifndef WIN32
#include "ccminer-config.h"
#else
#include "ccminer-config-win.h"
#endif

#ifdef WIN32
#ifndef __cplusplus
#define inline __inline
Expand Down Expand Up @@ -95,6 +94,9 @@ enum
LOG_RAW = 0x99
};
#endif
#ifdef __cplusplus
using namespace std;
#endif

typedef unsigned char uchar;

Expand Down
2 changes: 1 addition & 1 deletion myriadgroestl.cpp
Expand Up @@ -5,11 +5,11 @@
#include <stdint.h>
#endif
#include <openssl/sha.h>
#include <cuda_runtime.h>

#include "sph/sph_groestl.h"

#include "miner.h"
#include <cuda_runtime.h>
extern bool stop_mining;
extern volatile bool mining_has_stopped[MAX_GPUS];

Expand Down
4 changes: 2 additions & 2 deletions nvml.cpp
Expand Up @@ -26,10 +26,10 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "cuda_runtime.h"
#include "nvml.h"

#include "miner.h"
#include "nvml.h"
#include "cuda_runtime.h"

#ifdef USE_WRAPNVML

Expand Down
12 changes: 6 additions & 6 deletions nvsettings.cpp
Expand Up @@ -6,16 +6,16 @@
*/

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h> // pid_t

#include "miner.h"
#include "nvml.h"
#include <cstdint>
#include "cuda_runtime.h"
#include "nvml.h"
#include "miner.h"

#ifdef __linux__

Expand Down
1 change: 0 additions & 1 deletion qubit/qubit_luffa512.cu
Expand Up @@ -20,7 +20,6 @@
#ifdef __cplusplus
#include <cstdint>
#include <cstdio>
using namespace std;
#else
#include <stdint.h>
#include <stdio.h>
Expand Down
4 changes: 2 additions & 2 deletions sph/neoscrypt-cpu.cpp
Expand Up @@ -402,7 +402,7 @@ static void neoscrypt_blkcpy(void *dstp, const void *srcp, uint len) {
static void neoscrypt_blkswp(void *blkAp, void *blkBp, uint len) {
ulong *blkA = (ulong *) blkAp;
ulong *blkB = (ulong *) blkBp;
register ulong t0, t1, t2, t3;
ulong t0, t1, t2, t3;
uint i;

for(i = 0; i < (len / sizeof(ulong)); i += 4) {
Expand Down Expand Up @@ -903,7 +903,7 @@ void neoscrypt(const uchar *password, uchar *output, uint profile) {
r = (1 << ((profile >> 5) & 0x7));
}
uchar *stack;
stack = (uchar*)malloc(((N + 3) * r * 2 * SCRYPT_BLOCK_SIZE + stack_align)*sizeof(uchar));
stack = (uchar*)malloc((((size_t)N + 3) * r * 2 * SCRYPT_BLOCK_SIZE + stack_align)*sizeof(uchar));
if(stack == NULL)
{
applog(LOG_ERR, "Out of memory!");
Expand Down
6 changes: 3 additions & 3 deletions sysinfos.cpp
Expand Up @@ -10,8 +10,8 @@
#include <ctype.h>
#include <cstdlib>
#include <cstring>
using namespace std;
#include "miner.h"
#include <cstdint>
//#include "miner.h"

#ifndef WIN32

Expand Down Expand Up @@ -86,7 +86,7 @@ float cpu_temp(int core)
#endif
}

uint32_t cpu_clock(int core)
std::uint32_t cpu_clock(int core)
{
#ifdef WIN32
return 0;
Expand Down
1 change: 0 additions & 1 deletion util.cpp
Expand Up @@ -31,7 +31,6 @@
#include <netinet/tcp.h>
#endif
#include "elist.h"
using namespace std;
#include "miner.h"


Expand Down
1 change: 0 additions & 1 deletion x13/cuda_x13_hamsi512.cu
@@ -1,7 +1,6 @@
#ifdef __cplusplus
#include <cstdint>
#include <cstdio>
using namespace std;
#else
#include <stdint.h>
#include <stdio.h>
Expand Down

0 comments on commit 7b85c65

Please sign in to comment.