Skip to content

Fix deprecated C headers + use #include<> for external libs #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ node_js:
- "12.14.1"

before_install:
- export CXX="g++-4.9" CC="gcc-4.9"
- export CXX="clang-9.0" CC="clang++-9.0"

script:
- npm run standard
Expand All @@ -31,5 +31,5 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
- clang-9.0
- clang++-9.0
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: Visual Studio 2015
image: Visual Studio 2017

environment:
matrix:
Expand Down
49 changes: 42 additions & 7 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
],

"variables": {
"tests": 0
"tests": 0,
"STANDARD": 17,
"MACOSX_DEPLOYMENT_TARGET": "10.8"
},

"conditions": [
Expand Down Expand Up @@ -100,20 +102,19 @@
"conditions": [
['OS=="mac"', {
'cflags': [
'-mmacosx-version-min=10.8'
"-mmacosx-version-min=<(MACOSX_DEPLOYMENT_TARGET)"
],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
'MACOSX_DEPLOYMENT_TARGET': '10.8',
'MACOSX_DEPLOYMENT_TARGET': '<(MACOSX_DEPLOYMENT_TARGET)',
}
}]
]
}]
}]
],

"target_defaults": {
"cflags_cc": ["-std=c++11"],
"cflags_cc": [ "-std=c++<(STANDARD)" ],
"conditions": [
['OS=="mac"', {
"xcode_settings": {
Expand All @@ -129,6 +130,40 @@
"NOMINMAX"
],
}]
]
}
],
'default_configuration': 'Release',
'configurations': {
# Release Settings
'Release': {
'defines': [ 'NDEBUG' ],
"cflags": [ "-fno-exceptions", "-Ofast" ],
"cflags_cc": [ "-fno-exceptions", "-Ofast", "-std=c++<(STANDARD)" ],
"xcode_settings": {
'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD": "c++<(STANDARD)",
'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)"
}, # XCODE
"msvs_settings": {
"VCCLCompilerTool": {
'ExceptionHandling': 0, # /EHsc
'MultiProcessorCompilation': 'true',
'RuntimeTypeInfo': 'false',
'Optimization': 3, # full optimizations /O2 == /Og /Oi /Ot /Oy /Ob2 /GF /Gy
'StringPooling': 'true', # pool string literals
"AdditionalOptions": [
# C++ standard
"/std:c++<(STANDARD)",

# Optimizations
"/O2",
# "/Ob3", # aggressive inline
"/GL", # whole Program Optimization # /LTCG is implied with /GL.
"/DNDEBUG" # turn off asserts
],
}
} # MSVC
}, # Release
}, # configurations
} # target-defaults
}
2 changes: 1 addition & 1 deletion src/bindings/bindings.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "marker-index-wrapper.h"
#include "nan.h"
#include <nan.h>
#include "patch-wrapper.h"
#include "range-wrapper.h"
#include "point-wrapper.h"
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/em/auto-wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <emscripten/val.h>
#include "flat_set.h"
#include "marker-index.h"
#include "optional.h"
#include <optional>
using std::optional;
#include "point.h"
#include "text.h"

Expand Down
5 changes: 3 additions & 2 deletions src/bindings/marker-index-wrapper.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "marker-index-wrapper.h"
#include <unordered_map>
#include "marker-index.h"
#include "nan.h"
#include <nan.h>
#include "noop.h"
#include "optional.h"
#include <optional>
using std::optional;
#include "point-wrapper.h"
#include "range.h"

Expand Down
5 changes: 3 additions & 2 deletions src/bindings/marker-index-wrapper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "nan.h"
#include <nan.h>
#include "marker-index.h"
#include "optional.h"
#include <optional>
using std::optional;
#include "range.h"

class MarkerIndexWrapper : public Nan::ObjectWrap {
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/noop.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#include "nan.h"
#include <nan.h>

static void noop(const Nan::FunctionCallbackInfo<v8::Value>&) {}
5 changes: 3 additions & 2 deletions src/bindings/number-conversion.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef SUPERSTRING_NUMBER_CONVERSION_H
#define SUPERSTRING_NUMBER_CONVERSION_H

#include "nan.h"
#include "optional.h"
#include <nan.h>
#include <optional>
using std::optional;

namespace number_conversion {
template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/point-wrapper.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "point-wrapper.h"
#include <cmath>
#include "nan.h"
#include <nan.h>

using namespace v8;

Expand Down
5 changes: 3 additions & 2 deletions src/bindings/point-wrapper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef SUPERSTRING_POINT_WRAPPER_H
#define SUPERSTRING_POINT_WRAPPER_H

#include "nan.h"
#include "optional.h"
#include <nan.h>
#include <optional>
using std::optional;
#include "point.h"

class PointWrapper : public Nan::ObjectWrap {
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/range-wrapper.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "range-wrapper.h"
#include "point-wrapper.h"
#include "nan.h"
#include <nan.h>

using namespace v8;

Expand Down
5 changes: 3 additions & 2 deletions src/bindings/range-wrapper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef SUPERSTRING_RANGE_WRAPPER_H
#define SUPERSTRING_RANGE_WRAPPER_H

#include "nan.h"
#include "optional.h"
#include <nan.h>
#include <optional>
using std::optional;
#include "point.h"
#include "range.h"

Expand Down
5 changes: 3 additions & 2 deletions src/bindings/string-conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#define SUPERSTRING_STRING_CONVERSION_H

#include <string>
#include "nan.h"
#include "optional.h"
#include <nan.h>
#include <optional>
using std::optional;
#include "text.h"

namespace string_conversion {
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/text-buffer-snapshot-wrapper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SUPERSTRING_TEXT_BUFFER_SNAPSHOT_WRAPPER_H
#define SUPERSTRING_TEXT_BUFFER_SNAPSHOT_WRAPPER_H

#include "nan.h"
#include <nan.h>
#include <string>

// This header can be included by other native node modules, allowing them
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/text-buffer-wrapper.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "text-buffer-wrapper.h"
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <cstdio>
#include "number-conversion.h"
#include "point-wrapper.h"
#include "range-wrapper.h"
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/text-buffer-wrapper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SUPERSTRING_TEXT_BUFFER_WRAPPER_H
#define SUPERSTRING_TEXT_BUFFER_WRAPPER_H

#include "nan.h"
#include <nan.h>
#include "text-buffer.h"
#include <unordered_set>

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/text-reader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SUPERSTRING_TEXT_READER_H
#define SUPERSTRING_TEXT_READER_H

#include "nan.h"
#include <nan.h>
#include "text.h"
#include "text-buffer.h"
#include "encoding-conversion.h"
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/text-writer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SUPERSTRING_TEXT_WRITER_H
#define SUPERSTRING_TEXT_WRITER_H

#include "nan.h"
#include <nan.h>
#include "text.h"
#include "encoding-conversion.h"

Expand Down
2 changes: 1 addition & 1 deletion src/core/encoding-conversion.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "encoding-conversion.h"
#include "utf8-conversions.h"
#include <iconv.h>
#include <string.h>
#include <cstring>

using std::function;
using std::u16string;
Expand Down
5 changes: 3 additions & 2 deletions src/core/encoding-conversion.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef SUPERSTRING_ENCODING_CONVERSION_H_
#define SUPERSTRING_ENCODING_CONVERSION_H_

#include "optional.h"
#include <optional>
using std::optional;
#include "text.h"
#include <stdio.h>
#include <cstdio>

class EncodingConversion {
void *data;
Expand Down
6 changes: 3 additions & 3 deletions src/core/libmba-diff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
*/

#include "libmba-diff.h"
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <cstdlib>
#include <climits>
#include <cerrno>
#include <vector>

using std::vector;
Expand Down
2 changes: 1 addition & 1 deletion src/core/libmba-diff.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MBA_DIFF_H_
#define MBA_DIFF_H_

#include <stdint.h>
#include <cstdint>
#include <vector>

typedef enum {
Expand Down
2 changes: 1 addition & 1 deletion src/core/marker-index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <climits>
#include <iterator>
#include <random>
#include <stdlib.h>
#include <cstdlib>
#include "range.h"

using std::default_random_engine;
Expand Down
29 changes: 0 additions & 29 deletions src/core/optional.h

This file was deleted.

7 changes: 4 additions & 3 deletions src/core/patch.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "patch.h"
#include "optional.h"
#include <optional>
using std::optional;
#include "text.h"
#include "text-slice.h"
#include <assert.h>
#include <cassert>
#include <cmath>
#include <memory>
#include <stdio.h>
#include <cstdio>
#include <sstream>
#include <vector>

Expand Down
3 changes: 2 additions & 1 deletion src/core/patch.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef PATCH_H_
#define PATCH_H_

#include "optional.h"
#include <optional>
using std::optional;
#include "point.h"
#include "serializer.h"
#include "text.h"
Expand Down
4 changes: 2 additions & 2 deletions src/core/regex.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "regex.h"
#include <stdlib.h>
#include "pcre2.h"
#include <cstdlib>
#include <pcre2.h>

using std::u16string;
using MatchResult = Regex::MatchResult;
Expand Down
3 changes: 2 additions & 1 deletion src/core/regex.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef REGEX_H_
#define REGEX_H_

#include "optional.h"
#include <optional>
using std::optional;
#include <string>

struct pcre2_real_code_16;
Expand Down
2 changes: 1 addition & 1 deletion src/core/text-diff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "libmba-diff.h"
#include "text-slice.h"
#include <vector>
#include <string.h>
#include <cstring>
#include <ostream>
#include <cassert>

Expand Down
Loading