Skip to content
Merged
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
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ See docs/process.md for more on how version tagging works.

4.0.16 (in development)
-----------------------
- A warning was added about usage of embind without C++17 or above. (#25424)
- The minimum supported versions of Node, Chrome and Firefox were bumped
enabling the removal of the `globalThis` polyfill and universally enabling
mutable globals: (#25375, #25385)
Expand Down
4 changes: 0 additions & 4 deletions system/include/emscripten/bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

#pragma once

#if __cplusplus < 201103L
#error Including <emscripten/bind.h> requires building with -std=c++11 or newer!
#endif

#include <cassert>
#include <cstddef>
#include <functional>
Expand Down
4 changes: 0 additions & 4 deletions system/include/emscripten/val.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

#pragma once

#if __cplusplus < 201103L
#error Including <emscripten/val.h> requires building with -std=c++11 or newer!
#endif

#include <cassert>
#include <array>
#include <climits>
Expand Down
6 changes: 5 additions & 1 deletion system/include/emscripten/wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#pragma once

#if __cplusplus < 201103L
#error Including <emscripten/wire.h> requires building with -std=c++11 or newer!
#error "embind requires -std=c++11 or newer"
#endif

#if __cplusplus < 201703L
#warning "embind is likely moving to c++17 (https://github.com/emscripten-core/emscripten/issues/24850)"
#endif

// A value moving between JavaScript and C++ has three representations:
Expand Down
10 changes: 9 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ def test_embind_no_raw_pointers(self, filename):
# With no arguments we are effectively testing c++17 since it is the default.
'': [],
# Ensure embind compiles under C++11 which is the miniumum supported version.
'cxx11': ['-std=c++11'],
'cxx11': ['-std=c++11', '-Wno-#warnings'],
'o1': ['-O1'],
'o2': ['-O2'],
'o2_mem_growth': ['-O2', '-sALLOW_MEMORY_GROWTH', test_file('embind/isMemoryGrowthEnabled=true.cpp')],
Expand Down Expand Up @@ -3377,6 +3377,14 @@ def test_embind(self, *extra_args):
output = self.run_js(js_file)
self.assertNotContained('FAIL', output)

def test_embind_cxx11_warning(self):
err = self.run_process([EMXX, '-c', '-std=c++11', test_file('embind/test_unsigned.cpp')], stderr=PIPE).stderr
self.assertContained('#warning "embind is likely moving to c++17', err)

def test_embind_cxx03(self):
err = self.expect_fail([EMXX, '-c', '-std=c++03', test_file('embind/test_unsigned.cpp')])
self.assertContained('#error "embind requires -std=c++11 or newer"', err)

@requires_node
def test_embind_finalization(self):
self.run_process(
Expand Down