Skip to content

Instantly share code, notes, and snippets.

#include <functional>
#include <tuple>
namespace detail {
template <int N>
struct placeholder { };
}
namespace std {
template <int N>
INCLUDES=src src_api src_sys src_usb
CC=h8300-elf-gcc -std=gnu99 -msx -mint32 -c $(addprefix -I, $(INCLUDES))
CFLAGS=-O0 -g3 -Wall
CXX=h8300-elf-g++ -msx -mint32 -c $(addprefix -I, $(INCLUDES))
CXXFLAGS=$(CFLAGS) -fno-rtti -fno-exceptions
AS=h8300-elf-gcc -msx -mint32 -Xassembler $(addprefix -I, $(INCLUDES))
ASFLAGS=-g3
LINK=h8300-elf-gcc -msx -mint32 -nostartfiles -nodefaultlibs
LINKFLAGS=-g3
OBJCOPY=h8300-elf-objcopy
#include "sci.hpp"
#include <stddef.h>
#define set_imask_ccr(b) (b ? ({asm volatile ("orc #0x80, ccr");}) : ({asm volatile ("andc #0x7F, ccr");}))
#define get_imask_ccr() ({ unsigned char __r; asm volatile ("stc.b ccr, %s0": "=r"(__r)); !!(__r&0x80); })
struct lock_interrupt {
__attribute__((always_inline)) lock_interrupt() : masked(get_imask_ccr()) {
set_imask_ccr(1);
}
#include <setjmp.h>
#define SET_STACK(stack) asm("movl %0, %%esp": : "r"(stack))
//#define SET_STACK(stack) asm("mov %0, sp" : : "r"(stack));
template <typename FnctrT>
struct coroutine {
int operator ()() {
if (volatile int n = setjmp(jb_outer)) {
return n;
#include <algorithm>
#include <array>
#include <chrono>
#include <functional>
#include <iostream>
#include <memory>
#include <numeric>
#include <random>
#include <vector>
diff --git a/pstade/egg/detail/little_indirect_result.hpp b/pstade/egg/detail/little_indirect_result.hpp
old mode 100644
new mode 100755
index 4785954..bf2cfeb
--- a/pstade/egg/detail/little_indirect_result.hpp
+++ b/pstade/egg/detail/little_indirect_result.hpp
@@ -45,8 +45,8 @@ namespace pstade { namespace egg { namespace detail {
}
// 0ary
#include <array>
template <typename T, typename ...Args>
inline std::array<T, sizeof...(Args)> make_array(Args &&...args) {
return std::array<T, sizeof...(Args)>{ std::forward<Args>(args)... };
}
#define MAKE_ARRAY(T, ...) decltype(make_array<T>(__VA_ARGS__)){__VA_ARGS__}
#include <typeinfo>
#include <cstddef>
#include <iostream>
namespace cts { // compile time string
using std::size_t;
template <size_t From, typename charT, size_t N1, size_t N2>
struct eq_helper {
static constexpr int exec(const charT (&s1)[N1], const charT (&s2)[N2]) {
return s1[From]<s2[From] ? -1 : s2[From]<s1[From] ? 1 : eq_helper<From+1, charT, N1, N2>::exec(s1, s2);
}
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3226,6 +3226,22 @@ check_field_decls (tree t, tree *access_decls,
warning (OPT_Weffc__,
" but does not override %<operator=(const %T&)%>", t);
}
+ if (cxx_dialect >= cxx0x
+ && (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ || type_has_move_constructor (t) || type_has_move_assign (t))
+ && !(TYPE_HAS_COPY_CTOR (t) && TYPE_HAS_COPY_ASSIGN (t)
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3226,6 +3226,22 @@ check_field_decls (tree t, tree *access_decls,
warning (OPT_Weffc__,
" but does not override %<operator=(const %T&)%>", t);
}
+ if (cxx_dialect >= cxx0x
+ && (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ || type_has_move_constructor (t) || type_has_move_assign (t))
+ && !(TYPE_HAS_COPY_CTOR (t) && TYPE_HAS_COPY_ASSIGN (t)