Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ff8dd3f4
Commit
ff8dd3f4
authored
Jan 20, 2015
by
Damien George
Browse files
py, unix: Allow to compile with -Wunused-parameter.
See issue #699.
parent
50912e7f
Changes
51
Hide whitespace changes
Inline
Side-by-side
py/objstrunicode.c
View file @
ff8dd3f4
...
...
@@ -114,6 +114,8 @@ STATIC mp_obj_t uni_unary_op(mp_uint_t op, mp_obj_t self_in) {
}
STATIC
mp_obj_t
str_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
#if MICROPY_CPYTHON_COMPAT
if
(
n_kw
!=
0
)
{
mp_arg_error_unimpl_kw
();
...
...
@@ -160,6 +162,7 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
// be capped to the first/last character of the string, depending on is_slice.
const
byte
*
str_index_to_ptr
(
const
mp_obj_type_t
*
type
,
const
byte
*
self_data
,
mp_uint_t
self_len
,
mp_obj_t
index
,
bool
is_slice
)
{
(
void
)
type
;
mp_int_t
i
;
// Copied from mp_get_index; I don't want bounds checking, just give me
// the integer as-is. (I can't bounds-check without scanning the whole
...
...
py/objtuple.c
View file @
ff8dd3f4
...
...
@@ -62,6 +62,8 @@ void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *en
}
STATIC
mp_obj_t
mp_obj_tuple_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
mp_arg_check_num
(
n_args
,
n_kw
,
0
,
1
,
false
);
switch
(
n_args
)
{
...
...
py/objtype.c
View file @
ff8dd3f4
...
...
@@ -671,11 +671,14 @@ STATIC mp_obj_t instance_getiter(mp_obj_t self_in) {
// - creating a new class (a new type) creates a new mp_obj_type_t
STATIC
void
type_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_type_t
*
self
=
self_in
;
print
(
env
,
"<class '%s'>"
,
qstr_str
(
self
->
name
));
}
STATIC
mp_obj_t
type_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
mp_arg_check_num
(
n_args
,
n_kw
,
1
,
3
,
false
);
switch
(
n_args
)
{
...
...
@@ -841,6 +844,7 @@ typedef struct _mp_obj_super_t {
}
mp_obj_super_t
;
STATIC
void
super_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_super_t
*
self
=
self_in
;
print
(
env
,
"<super: "
);
mp_obj_print_helper
(
print
,
env
,
self
->
type
,
PRINT_STR
);
...
...
@@ -850,6 +854,7 @@ STATIC void super_print(void (*print)(void *env, const char *fmt, ...), void *en
}
STATIC
mp_obj_t
super_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
if
(
n_args
!=
2
||
n_kw
!=
0
)
{
// 0 arguments are turned into 2 in the compiler
// 1 argument is not yet implemented
...
...
py/objzip.c
View file @
ff8dd3f4
...
...
@@ -40,7 +40,7 @@ STATIC mp_obj_t zip_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
mp_arg_check_num
(
n_args
,
n_kw
,
0
,
MP_OBJ_FUN_ARGS_MAX
,
false
);
mp_obj_zip_t
*
o
=
m_new_obj_var
(
mp_obj_zip_t
,
mp_obj_t
,
n_args
);
o
->
base
.
type
=
&
mp_
type_
zip
;
o
->
base
.
type
=
type_
in
;
o
->
n_iters
=
n_args
;
for
(
mp_uint_t
i
=
0
;
i
<
n_args
;
i
++
)
{
o
->
iters
[
i
]
=
mp_getiter
(
args
[
i
]);
...
...
py/parsenumbase.c
View file @
ff8dd3f4
...
...
@@ -29,6 +29,7 @@
// find real radix base, and strip preceding '0x', '0o' and '0b'
// puts base in *base, and returns number of bytes to skip the prefix
mp_uint_t
mp_parse_num_base
(
const
char
*
str
,
mp_uint_t
len
,
mp_uint_t
*
base
)
{
(
void
)
len
;
// TODO use given len?
const
byte
*
p
=
(
const
byte
*
)
str
;
unichar
c
=
*
(
p
++
);
if
((
*
base
==
0
||
*
base
==
16
)
&&
c
==
'0'
)
{
...
...
py/pfenv.c
View file @
ff8dd3f4
...
...
@@ -179,6 +179,8 @@ int pfenv_print_int(const pfenv_t *pfenv, mp_uint_t x, int sgn, int base, int ba
}
int
pfenv_print_mp_int
(
const
pfenv_t
*
pfenv
,
mp_obj_t
x
,
int
sgn
,
int
base
,
int
base_char
,
int
flags
,
char
fill
,
int
width
,
int
prec
)
{
(
void
)
sgn
;
// TODO why is sgn unused?
if
(
!
MP_OBJ_IS_INT
(
x
))
{
// This will convert booleans to int, or raise an error for
// non-integer types.
...
...
py/pfenv_printf.c
View file @
ff8dd3f4
...
...
@@ -196,6 +196,7 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, ...) {
}
void
printf_wrapper
(
void
*
env
,
const
char
*
fmt
,
...)
{
(
void
)
env
;
va_list
args
;
va_start
(
args
,
fmt
);
vprintf
(
fmt
,
args
);
...
...
py/sequence.c
View file @
ff8dd3f4
...
...
@@ -98,6 +98,8 @@ bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice
#endif
mp_obj_t
mp_seq_extract_slice
(
mp_uint_t
len
,
const
mp_obj_t
*
seq
,
mp_bound_slice_t
*
indexes
)
{
(
void
)
len
;
// TODO can we remove len from the arg list?
mp_int_t
start
=
indexes
->
start
,
stop
=
indexes
->
stop
;
mp_int_t
step
=
indexes
->
step
;
...
...
unix/file.c
View file @
ff8dd3f4
...
...
@@ -61,6 +61,7 @@ extern const mp_obj_type_t mp_type_fileio;
extern
const
mp_obj_type_t
mp_type_textio
;
STATIC
void
fdfile_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_fdfile_t
*
self
=
self_in
;
print
(
env
,
"<io.%s %d>"
,
mp_obj_get_type_str
(
self
),
self
->
fd
);
}
...
...
@@ -123,6 +124,7 @@ STATIC mp_obj_t fdfile_close(mp_obj_t self_in) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
fdfile_close_obj
,
fdfile_close
);
STATIC
mp_obj_t
fdfile___exit__
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
(
void
)
n_args
;
return
fdfile_close
(
args
[
0
]);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
fdfile___exit___obj
,
4
,
4
,
fdfile___exit__
);
...
...
unix/modffi.c
View file @
ff8dd3f4
...
...
@@ -161,6 +161,7 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
// FFI module
STATIC
void
ffimod_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_ffimod_t
*
self
=
self_in
;
print
(
env
,
"<ffimod %p>"
,
self
->
handle
);
}
...
...
@@ -173,6 +174,7 @@ STATIC mp_obj_t ffimod_close(mp_obj_t self_in) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
ffimod_close_obj
,
ffimod_close
);
STATIC
mp_obj_t
ffimod_func
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
(
void
)
n_args
;
// always 4
mp_obj_ffimod_t
*
self
=
args
[
0
];
const
char
*
rettype
=
mp_obj_str_get_str
(
args
[
1
]);
const
char
*
symname
=
mp_obj_str_get_str
(
args
[
2
]);
...
...
@@ -267,6 +269,9 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna
MP_DEFINE_CONST_FUN_OBJ_3
(
ffimod_var_obj
,
ffimod_var
);
STATIC
mp_obj_t
ffimod_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
n_args
;
(
void
)
n_kw
;
const
char
*
fname
=
mp_obj_str_get_str
(
args
[
0
]);
void
*
mod
=
dlopen
(
fname
,
RTLD_NOW
|
RTLD_LOCAL
);
...
...
@@ -298,6 +303,7 @@ STATIC const mp_obj_type_t ffimod_type = {
// FFI function
STATIC
void
ffifunc_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_ffifunc_t
*
self
=
self_in
;
print
(
env
,
"<ffifunc %p>"
,
self
->
func
);
}
...
...
@@ -366,6 +372,7 @@ STATIC const mp_obj_type_t ffifunc_type = {
// FFI callback for Python function
STATIC
void
fficallback_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_fficallback_t
*
self
=
self_in
;
print
(
env
,
"<fficallback %p>"
,
self
->
func
);
}
...
...
@@ -379,6 +386,7 @@ STATIC const mp_obj_type_t fficallback_type = {
// FFI variable
STATIC
void
ffivar_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_ffivar_t
*
self
=
self_in
;
// Variable value printed as cast to int
print
(
env
,
"<ffivar @%p: 0x%x>"
,
self
->
var
,
*
(
int
*
)
self
->
var
);
...
...
unix/modsocket.c
View file @
ff8dd3f4
...
...
@@ -83,6 +83,7 @@ STATIC mp_obj_socket_t *socket_new(int fd) {
STATIC
void
socket_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_socket_t
*
self
=
self_in
;
print
(
env
,
"<_socket %d>"
,
self
->
fd
);
}
...
...
@@ -206,6 +207,7 @@ STATIC mp_obj_t socket_send(mp_uint_t n_args, const mp_obj_t *args) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
socket_send_obj
,
2
,
3
,
socket_send
);
STATIC
mp_obj_t
socket_setsockopt
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
(
void
)
n_args
;
// always 4
mp_obj_socket_t
*
self
=
args
[
0
];
int
level
=
MP_OBJ_SMALL_INT_VALUE
(
args
[
1
]);
int
option
=
mp_obj_get_int
(
args
[
2
]);
...
...
@@ -259,6 +261,9 @@ STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
socket_makefile_obj
,
1
,
3
,
socket_makefile
);
STATIC
mp_obj_t
socket_make_new
(
mp_obj_t
type_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
(
void
)
type_in
;
(
void
)
n_kw
;
int
family
=
AF_INET
;
int
type
=
SOCK_STREAM
;
int
proto
=
0
;
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment