mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
refactor: remove trailing whitespace from C, Header, Ruby and YAML files
Lint
This commit is contained in:
@@ -23,7 +23,7 @@ jobs:
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
|
||||
@@ -11,7 +11,7 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
|
||||
# To compile mruby with DreamSDK, RubyInstaller for Windows should be installed
|
||||
DREAMSDK_HOME = ENV["DREAMSDK_HOME"]
|
||||
MSYS_ROOT = !(DREAMSDK_HOME.nil? || DREAMSDK_HOME.empty?) ? "#{DREAMSDK_HOME}/msys/1.0" : ""
|
||||
|
||||
|
||||
# Setting paths
|
||||
DREAMCAST_PATH = "#{MSYS_ROOT}/opt/toolchains/dc"
|
||||
KOS_PATH = "#{DREAMCAST_PATH}/kos"
|
||||
@@ -37,16 +37,16 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
|
||||
cxx.defines = conf.cc.defines.dup
|
||||
cxx.compile_options = conf.cc.compile_options.dup
|
||||
end
|
||||
|
||||
|
||||
# Linker
|
||||
# There is an issue when making the mruby library with KallistiOS:
|
||||
# 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly
|
||||
# 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly
|
||||
# specified here at least for now.
|
||||
conf.linker do |linker|
|
||||
linker.command="#{BIN_PATH}/sh-elf-gcc"
|
||||
linker.flags << ["#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_kill.o", "#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"]
|
||||
linker.library_paths << ["#{KOS_PATH}/lib/dreamcast", "#{KOS_PATH}/addons/lib/dreamcast", "#{KOS_PATH}/../kos-ports/lib"]
|
||||
end
|
||||
end
|
||||
|
||||
# Archiver
|
||||
conf.archiver do |archiver|
|
||||
@@ -62,7 +62,7 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
|
||||
|
||||
# Disable C++ exception
|
||||
conf.disable_cxx_exception
|
||||
|
||||
|
||||
# Gems from core
|
||||
# removing mruby-io
|
||||
conf.gem :core => "mruby-metaprog"
|
||||
|
||||
@@ -64,7 +64,7 @@ struct RArray {
|
||||
#define ARY_SET_EMBED_LEN(a,len) ((a)->flags = ((a)->flags&~MRB_ARY_EMBED_MASK) | ((uint32_t)(len) + 1))
|
||||
#define ARY_EMBED_PTR(a) ((a)->as.ary)
|
||||
#endif
|
||||
|
||||
|
||||
#define ARY_LEN(a) (ARY_EMBED_P(a)?ARY_EMBED_LEN(a):(a)->as.heap.len)
|
||||
#define ARY_PTR(a) (ARY_EMBED_P(a)?ARY_EMBED_PTR(a):(a)->as.heap.ptr)
|
||||
#define RARRAY_LEN(a) ARY_LEN(RARRAY(a))
|
||||
|
||||
@@ -182,8 +182,8 @@ MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t
|
||||
MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
|
||||
MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c);
|
||||
|
||||
/** program load functions
|
||||
* Please note! Currently due to interactions with the GC calling these functions will
|
||||
/** program load functions
|
||||
* Please note! Currently due to interactions with the GC calling these functions will
|
||||
* leak one RProc object per function call.
|
||||
* To prevent this save the current memory arena before calling and restore the arena
|
||||
* right after, like so
|
||||
|
||||
@@ -159,7 +159,7 @@ MRB_API mrb_int mrb_str_index(mrb_state *mrb, mrb_value str, const char *p, mrb_
|
||||
*
|
||||
* mrb_close(mrb);
|
||||
* return 0;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Result:
|
||||
*
|
||||
|
||||
@@ -2498,7 +2498,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
else {
|
||||
if (i < 0) {
|
||||
if (i == -1) genop_1(s, OP_LOADI__1, cursp());
|
||||
else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
|
||||
else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
|
||||
else if (i >= INT16_MIN) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
|
||||
else if (i >= INT32_MIN) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
|
||||
else goto lit_int;
|
||||
|
||||
@@ -567,7 +567,7 @@ assert 'Enumerator.produce' do
|
||||
# Without initial object
|
||||
passed_args = []
|
||||
enum = Enumerator.produce {|obj| passed_args << obj; (obj || 0).succ }
|
||||
assert_equal Enumerator, enum.class
|
||||
assert_equal Enumerator, enum.class
|
||||
assert_take [1, 2, 3], enum
|
||||
assert_equal [nil, 1, 2], passed_args
|
||||
|
||||
|
||||
@@ -290,20 +290,20 @@ mrb_file__getwd(mrb_state *mrb, mrb_value klass)
|
||||
#define IS_DEVICEID(x) (x == '.' || x == '?')
|
||||
#define CHECK_UNCDEV_PATH (IS_FILESEP(path[0]) && IS_FILESEP(path[1]))
|
||||
|
||||
static int
|
||||
static int
|
||||
is_absolute_traditional_path(const char *path, size_t len)
|
||||
{
|
||||
if (len < 3) return 0;
|
||||
return (ISALPHA(path[0]) && IS_VOLSEP(path[1]) && IS_FILESEP(path[2]));
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
is_aboslute_unc_path(const char *path, size_t len) {
|
||||
if (len < 2) return 0;
|
||||
return (CHECK_UNCDEV_PATH && !IS_DEVICEID(path[2]));
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
is_absolute_device_path(const char *path, size_t len) {
|
||||
if (len < 4) return 0;
|
||||
return (CHECK_UNCDEV_PATH && IS_DEVICEID(path[2]) && IS_FILESEP(path[3]));
|
||||
@@ -316,8 +316,8 @@ mrb_file_is_absolute_path(const char *path)
|
||||
if (IS_FILESEP(path[0])) return 1;
|
||||
if (len > 0)
|
||||
return (
|
||||
is_absolute_traditional_path(path, len) ||
|
||||
is_aboslute_unc_path(path, len) ||
|
||||
is_absolute_traditional_path(path, len) ||
|
||||
is_aboslute_unc_path(path, len) ||
|
||||
is_absolute_device_path(path, len)
|
||||
);
|
||||
else
|
||||
|
||||
@@ -80,7 +80,7 @@ class Range
|
||||
last = self.end
|
||||
if block
|
||||
raise RangeError, "cannot get the minimum of endless range with custom comparison method" if last.nil?
|
||||
return super
|
||||
return super
|
||||
end
|
||||
return val if last.nil?
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ assert('Range#size') do
|
||||
assert_equal 41, (1...42).size
|
||||
assert_nil ('a'..'z').size
|
||||
assert_nil ('a'..).size
|
||||
|
||||
|
||||
assert_nil (1..).size unless Object.const_defined?(:Float)
|
||||
|
||||
skip unless Object.const_defined?(:Float)
|
||||
|
||||
@@ -96,7 +96,7 @@ rational_new(mrb_state *mrb, mrb_int numerator, mrb_int denominator)
|
||||
* md: max denominator value. Note that machine floating point number
|
||||
* has a finite resolution (10e-16 ish for 64 bit double), so specifying
|
||||
* a "best match with minimal error" is often wrong, because one can
|
||||
* always just retrieve the significand and return that divided by
|
||||
* always just retrieve the significand and return that divided by
|
||||
* 2**52, which is in a sense accurate, but generally not very useful:
|
||||
* 1.0/7.0 would be "2573485501354569/18014398509481984", for example.
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ rational_new_f(mrb_state *mrb, mrb_float f0)
|
||||
mrb_raise(mrb, E_RANGE_ERROR, "integer overflow in rational");
|
||||
}
|
||||
d = (mrb_int)f;
|
||||
|
||||
|
||||
/* continued fraction and check denominator each step */
|
||||
for (i = 0; i < 64; i++) {
|
||||
a = (mrb_int)(n ? d / n : 0);
|
||||
|
||||
@@ -24,7 +24,7 @@ vf_s_format_c(mrb_state *mrb, mrb_value klass)
|
||||
mrb_value fmt_str, arg_str;
|
||||
const char *fmt;
|
||||
char c;
|
||||
|
||||
|
||||
mrb_get_args(mrb, "SS", &fmt_str, &arg_str);
|
||||
fmt = RSTRING_CSTR(mrb, fmt_str);
|
||||
c = RSTRING_CSTR(mrb, arg_str)[0];
|
||||
@@ -164,7 +164,7 @@ mrb_init_test_vformat(mrb_state *mrb)
|
||||
|
||||
#define VF_DEFINE_FORMAT_METHOD(t) VF_DEFINE_FORMAT_METHOD_n(t,2)
|
||||
#define VF_DEFINE_FORMAT_METHOD_n(t,n) mrb_define_class_method(mrb, vf, #t, vf_s_format_##t, MRB_ARGS_REQ(n));
|
||||
|
||||
|
||||
VF_DEFINE_FORMAT_METHOD(c);
|
||||
VF_DEFINE_FORMAT_METHOD(d);
|
||||
#ifndef MRB_NO_FLOAT
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class Array
|
||||
# ISO 15.2.12.5.10
|
||||
def each(&block)
|
||||
return to_enum :each unless block
|
||||
|
||||
|
||||
idx = 0
|
||||
while idx < length
|
||||
block.call(self[idx])
|
||||
|
||||
+1
-1
@@ -1458,7 +1458,7 @@ fix_prepend_module(mrb_state *mrb, struct RBasic *obj, void *data)
|
||||
if (p->tt == MRB_TT_CLASS) break;
|
||||
if (p->c == m[0]) {
|
||||
include_module_at(mrb, ins_pos, ins_pos, m[1], 0);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
c = p;
|
||||
p = p->super;
|
||||
|
||||
+2
-2
@@ -138,7 +138,7 @@ get_pool_block_size(mrb_state *mrb, const mrb_irep *irep)
|
||||
#endif
|
||||
break;
|
||||
|
||||
default: /* packed IREP_TT_STRING */
|
||||
default: /* packed IREP_TT_STRING */
|
||||
{
|
||||
mrb_int len = irep->pool[pool_no].tt >> 2; /* unpack length */
|
||||
mrb_assert_int_fit(mrb_int, len, size_t, SIZE_MAX);
|
||||
@@ -961,7 +961,7 @@ dump_pool(mrb_state *mrb, const mrb_pool_value *p, FILE *fp)
|
||||
}
|
||||
|
||||
mrb_bool mrb_sym_static_p(mrb_state *mrb, mrb_sym sym);
|
||||
|
||||
|
||||
static int
|
||||
dump_sym(mrb_state *mrb, mrb_sym sym, FILE *fp)
|
||||
{
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ int_pow(mrb_state *mrb, mrb_value x)
|
||||
#ifndef MRB_NO_FLOAT
|
||||
mrb_value y = mrb_get_arg1(mrb);
|
||||
mrb_float z;
|
||||
|
||||
|
||||
if (!mrb_integer_p(y)) {
|
||||
mrb_get_args(mrb, "f", &z);
|
||||
z = pow((mrb_float)base, z);
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ assert('Integer#*', '15.2.8.3.3') do
|
||||
a = 1*1
|
||||
assert_equal 1, a
|
||||
if Object.const_defined?(:Float)
|
||||
b = 1*1.0
|
||||
b = 1*1.0
|
||||
assert_equal 1.0, b
|
||||
end
|
||||
assert_raise(TypeError){ 0*nil }
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ assert('Range#eql?', '15.2.14.4.14') do
|
||||
assert_false (1..).eql? "1.."
|
||||
skip unless Object.const_defined?(:Float)
|
||||
assert_false (1..10).eql? (Range.new(1.0, 10.0))
|
||||
assert_false (1..).eql? (Range.new(1.0, nil))
|
||||
assert_false (1..).eql? (Range.new(1.0, nil))
|
||||
end
|
||||
|
||||
assert('Range#initialize_copy', '15.2.14.4.15') do
|
||||
|
||||
Reference in New Issue
Block a user