diff --git a/lib/detail/strpatt.nelua b/lib/detail/strpatt.nelua index f6f0c62d..709105e9 100644 --- a/lib/detail/strpatt.nelua +++ b/lib/detail/strpatt.nelua @@ -63,9 +63,9 @@ function StrPatt.create(source: string, pattern: string, plain: boolean): StrPat return (@StrPatt) { source = source, pattern = pattern, + depth = MAX_MATCH_CALLS, plain = plain, anchor = anchor, - depth = MAX_MATCH_CALLS, } end diff --git a/lualib/nelua/cdefs.lua b/lualib/nelua/cdefs.lua index 11a6dd1c..9d156d9e 100644 --- a/lualib/nelua/cdefs.lua +++ b/lualib/nelua/cdefs.lua @@ -83,7 +83,6 @@ compilers_flags.cc = { cflags_release = "-O2 -DNDEBUG", cflags_maximum_performance = "-O3 -DNDEBUG", cflags_shared_lib = "-shared", - cflags_shared_lib_windows = "", cflags_assembly = "-S", cflags_object = "-c", cmd_compile = '$(cc) "$(cfile)" $(cflags) -o "$(binfile)"', @@ -113,7 +112,11 @@ compilers_flags.emcc = tabler.updatecopy(compilers_flags.gcc, { cflags_maximum_performance = "-O3 -ffast-math -DNDEBUG -fno-plt -flto", }) -- Clang -compilers_flags.clang = tabler.copy(compilers_flags.gcc) +compilers_flags.clang = tabler.updatecopy(compilers_flags.gcc, { + cmd_compile = '$(cc) -x c "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags) -o "$(binfile)"', + cmd_info = '$(cc) -E -x c "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags)', + cmd_defines = '$(cc) -E -dM -x c "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags)', +}) -- TCC compilers_flags.tcc = tabler.updatecopy(compilers_flags.cc, { cflags_base = "-w", @@ -133,7 +136,11 @@ compilers_flags['g++'] = tabler.updatecopy(compilers_flags.gcc, { ext = '.cpp', }) -- Clang (C++) -compilers_flags['clang++'] = tabler.copy(compilers_flags['g++']) +compilers_flags['clang++'] = tabler.updatecopy(compilers_flags['g++'], { + cmd_compile = '$(cc) -x c++ "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags) -o "$(binfile)"', + cmd_info = '$(cc) -E -x c++ "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags)', + cmd_defines = '$(cc) -E -dM -x c++ "$(cfile)" -x none -Wno-unused-command-line-argument $(cflags)', +}) -- NVCC (CUDA C++) compilers_flags['nvcc'] = tabler.updatecopy(compilers_flags.gcc, { cflags_base = "", diff --git a/lualib/nelua/cgenerator.lua b/lualib/nelua/cgenerator.lua index c3f680cc..78c95720 100644 --- a/lualib/nelua/cgenerator.lua +++ b/lualib/nelua/cgenerator.lua @@ -1617,13 +1617,14 @@ function cgenerator.emit_warning_pragmas(context) #pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wtautological-compare" + #pragma clang diagnostic ignored "-Wmissing-braces" #ifndef __cplusplus - #pragma clang diagnostic ignored "-Wmissing-braces" #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #pragma clang diagnostic error "-Wimplicit-function-declaration" #pragma clang diagnostic error "-Wimplicit-int" #else #pragma clang diagnostic ignored "-Wnarrowing" + #pragma clang diagnostic ignored "-Wc99-designator" #endif #elif defined(__GNUC__) && __GNUC__ >= 5 #pragma GCC diagnostic ignored "-Wtype-limits" diff --git a/spec/cgenerator_spec.lua b/spec/cgenerator_spec.lua index 08a61c1d..62de7b76 100644 --- a/spec/cgenerator_spec.lua +++ b/spec/cgenerator_spec.lua @@ -2403,9 +2403,9 @@ it("record methods", function() function vec2pointer:len() return self.x + self.y end assert(v:len() == 3) - local Math = @record{} - function Math.abs(x: number): number '> end - assert(Math.abs(-1) == 1) + local Str = @record{} + function Str.len(x: cstring): cint '> end + assert(Str.len('hello') == 5) local Foo = @record{x: integer, f: function(*Foo): integer} local foo: Foo = {1}