Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
7b028d5c
Commit
7b028d5c
authored
Aug 04, 2021
by
Johny Mattsson
Browse files
Cleanup warnings for luac_cross.
parent
aea83da7
Changes
7
Hide whitespace changes
Inline
Side-by-side
components/lua/lmathlib.c
View file @
7b028d5c
...
@@ -361,5 +361,6 @@ LROT_END(math, NULL, 0)
...
@@ -361,5 +361,6 @@ LROT_END(math, NULL, 0)
** Open math library
** Open math library
*/
*/
LUALIB_API
int
luaopen_math
(
lua_State
*
L
)
{
LUALIB_API
int
luaopen_math
(
lua_State
*
L
)
{
(
void
)
L
;
return
0
;
return
0
;
}
}
components/lua/loadlib.c
View file @
7b028d5c
...
@@ -625,6 +625,7 @@ static int ll_seeall (lua_State *L) {
...
@@ -625,6 +625,7 @@ static int ll_seeall (lua_State *L) {
static
void
setpath
(
lua_State
*
L
,
const
char
*
fieldname
,
const
char
*
envname
,
static
void
setpath
(
lua_State
*
L
,
const
char
*
fieldname
,
const
char
*
envname
,
const
char
*
def
)
{
const
char
*
def
)
{
(
void
)
envname
;
const
char
*
path
=
NULL
;
/* getenv(envname) not used in NodeMCU */
;
const
char
*
path
=
NULL
;
/* getenv(envname) not used in NodeMCU */
;
if
(
path
==
NULL
)
/* no environment variable? */
if
(
path
==
NULL
)
/* no environment variable? */
lua_pushstring
(
L
,
def
);
/* use default */
lua_pushstring
(
L
,
def
);
/* use default */
...
...
components/lua/lrotable.c
View file @
7b028d5c
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
#include "lapi.h"
#include "lapi.h"
#ifdef _MSC_VER
#ifdef _MSC_VER
#define ALIGNED_STRING
(
__declspec( align( 4 ) ) char
*)
#define ALIGNED_STRING __declspec( align( 4 ) ) char
#else
#else
#define ALIGNED_STRING
(
__attribute__((aligned(4))) char
*)
#define ALIGNED_STRING __attribute__((aligned(4))) char
#endif
#endif
#define LA_LINES 32
#define LA_LINES 32
#define LA_SLOTS 4
#define LA_SLOTS 4
...
@@ -82,7 +82,8 @@ static void update_cache(unsigned hash, ROTable *rotable, unsigned ndx) {
...
@@ -82,7 +82,8 @@ static void update_cache(unsigned hash, ROTable *rotable, unsigned ndx) {
*/
*/
const
TValue
*
luaR_findentry
(
ROTable
*
rotable
,
TString
*
key
,
unsigned
*
ppos
)
{
const
TValue
*
luaR_findentry
(
ROTable
*
rotable
,
TString
*
key
,
unsigned
*
ppos
)
{
const
luaR_entry
*
pentry
=
rotable
;
const
luaR_entry
*
pentry
=
rotable
;
const
char
*
strkey
=
key
?
getstr
(
key
)
:
ALIGNED_STRING
"__metatable"
;
static
const
ALIGNED_STRING
metatablestr
[]
=
"__metatable"
;
const
char
*
strkey
=
key
?
getstr
(
key
)
:
metatablestr
;
unsigned
hash
=
HASH
(
rotable
,
key
);
unsigned
hash
=
HASH
(
rotable
,
key
);
unsigned
i
=
0
;
unsigned
i
=
0
;
...
@@ -148,9 +149,7 @@ void luaR_next(lua_State *L, ROTable *rotable, TValue *key, TValue *val) {
...
@@ -148,9 +149,7 @@ void luaR_next(lua_State *L, ROTable *rotable, TValue *key, TValue *val) {
luaR_next_helper
(
L
,
rotable
,
0
,
key
,
val
);
luaR_next_helper
(
L
,
rotable
,
0
,
key
,
val
);
else
if
(
ttisstring
(
key
))
{
else
if
(
ttisstring
(
key
))
{
/* Find the previous key again */
/* Find the previous key again */
if
(
ttisstring
(
key
))
{
luaR_findentry
(
rotable
,
rawtsvalue
(
key
),
&
keypos
);
luaR_findentry
(
rotable
,
rawtsvalue
(
key
),
&
keypos
);
}
/* Advance to next key */
/* Advance to next key */
keypos
++
;
keypos
++
;
luaR_next_helper
(
L
,
rotable
,
keypos
,
key
,
val
);
luaR_next_helper
(
L
,
rotable
,
keypos
,
key
,
val
);
...
...
components/lua/lstring.c
View file @
7b028d5c
...
@@ -82,6 +82,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l,
...
@@ -82,6 +82,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l,
static
int
lua_is_ptr_in_ro_area
(
const
char
*
p
)
{
static
int
lua_is_ptr_in_ro_area
(
const
char
*
p
)
{
#ifdef LUA_CROSS_COMPILER
#ifdef LUA_CROSS_COMPILER
(
void
)
p
;
return
0
;
// TStrings are never in RO in luac.cross
return
0
;
// TStrings are never in RO in luac.cross
#else
#else
return
IN_RODATA_AREA
(
p
);
return
IN_RODATA_AREA
(
p
);
...
...
components/lua/lundump.c
View file @
7b028d5c
...
@@ -146,7 +146,7 @@ static lua_Number LoadNumber(LoadState* S)
...
@@ -146,7 +146,7 @@ static lua_Number LoadNumber(LoadState* S)
LoadVar
(
S
,
y
);
LoadVar
(
S
,
y
);
x
=
(
lua_Number
)
y
;
x
=
(
lua_Number
)
y
;
}
break
;
}
break
;
default:
lua_assert
(
0
);
default:
lua_assert
(
0
);
__builtin_unreachable
();
}
}
}
}
else
else
...
...
components/luac_cross/lflashimg.c
View file @
7b028d5c
...
@@ -125,6 +125,7 @@ extern void __attribute__((noreturn)) fatal(const char* message);
...
@@ -125,6 +125,7 @@ extern void __attribute__((noreturn)) fatal(const char* message);
* Serial allocator. Throw a luac-style out of memory error is allocaiton fails.
* Serial allocator. Throw a luac-style out of memory error is allocaiton fails.
*/
*/
static
void
*
flashAlloc
(
lua_State
*
L
,
size_t
n
)
{
static
void
*
flashAlloc
(
lua_State
*
L
,
size_t
n
)
{
(
void
)
L
;
void
*
p
=
(
void
*
)(
flashImage
+
curOffset
);
void
*
p
=
(
void
*
)(
flashImage
+
curOffset
);
curOffset
+=
ALIGN
(
n
)
>>
WORDSHIFT
;
curOffset
+=
ALIGN
(
n
)
>>
WORDSHIFT
;
if
(
curOffset
>
LUA_MAX_FLASH_SIZE
)
{
if
(
curOffset
>
LUA_MAX_FLASH_SIZE
)
{
...
@@ -140,6 +141,7 @@ static void *flashAlloc(lua_State* L, size_t n) {
...
@@ -140,6 +141,7 @@ static void *flashAlloc(lua_State* L, size_t n) {
*/
*/
#define toFlashAddr(l, pd, s) _toFlashAddr(l, &(pd), s)
#define toFlashAddr(l, pd, s) _toFlashAddr(l, &(pd), s)
static
void
_toFlashAddr
(
lua_State
*
L
,
FlashAddr
*
a
,
void
*
p
)
{
static
void
_toFlashAddr
(
lua_State
*
L
,
FlashAddr
*
a
,
void
*
p
)
{
(
void
)
L
;
uint
doffset
=
cast
(
char
*
,
a
)
-
cast
(
char
*
,
flashImage
);
uint
doffset
=
cast
(
char
*
,
a
)
-
cast
(
char
*
,
flashImage
);
lua_assert
(
!
(
doffset
&
(
WORDSIZE
-
1
)));
// check word aligned
lua_assert
(
!
(
doffset
&
(
WORDSIZE
-
1
)));
// check word aligned
doffset
>>=
WORDSHIFT
;
// and convert to a word offset
doffset
>>=
WORDSHIFT
;
// and convert to a word offset
...
@@ -399,9 +401,10 @@ static void *functionToFlash(lua_State* L, const Proto* orig) {
...
@@ -399,9 +401,10 @@ static void *functionToFlash(lua_State* L, const Proto* orig) {
uint
dumpToFlashImage
(
lua_State
*
L
,
const
Proto
*
main
,
lua_Writer
w
,
uint
dumpToFlashImage
(
lua_State
*
L
,
const
Proto
*
main
,
lua_Writer
w
,
void
*
data
,
int
strip
,
void
*
data
,
int
strip
,
lu_int32
address
,
lu_int32
maxSize
)
{
lu_int32
address
,
lu_int32
maxSize
)
{
(
void
)
strip
;
// parameter strip is ignored for now
// parameter strip is ignored for now
FlashHeader
*
fh
=
cast
(
FlashHeader
*
,
flashAlloc
(
L
,
sizeof
(
FlashHeader
)));
FlashHeader
*
fh
=
cast
(
FlashHeader
*
,
flashAlloc
(
L
,
sizeof
(
FlashHeader
)));
int
i
,
status
;
int
status
;
lua_newtable
(
L
);
lua_newtable
(
L
);
scanProtoStrings
(
L
,
main
);
scanProtoStrings
(
L
,
main
);
createROstrt
(
L
,
fh
);
createROstrt
(
L
,
fh
);
...
@@ -413,7 +416,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
...
@@ -413,7 +416,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
fatal
(
"The image is too large for specfied LFS size"
);
fatal
(
"The image is too large for specfied LFS size"
);
}
}
if
(
address
)
{
/* in absolute mode convert addresses to mapped address */
if
(
address
)
{
/* in absolute mode convert addresses to mapped address */
for
(
i
=
0
;
i
<
curOffset
;
i
++
)
for
(
uint
i
=
0
;
i
<
curOffset
;
i
++
)
if
(
getFlashAddrTag
(
i
))
if
(
getFlashAddrTag
(
i
))
flashImage
[
i
]
=
4
*
flashImage
[
i
]
+
address
;
flashImage
[
i
]
=
4
*
flashImage
[
i
]
+
address
;
lua_unlock
(
L
);
lua_unlock
(
L
);
...
...
components/luac_cross/loslib.c
View file @
7b028d5c
...
@@ -246,6 +246,7 @@ LROT_END(oslib, NULL, 0)
...
@@ -246,6 +246,7 @@ LROT_END(oslib, NULL, 0)
LUALIB_API
int
luaopen_os
(
lua_State
*
L
)
{
LUALIB_API
int
luaopen_os
(
lua_State
*
L
)
{
(
void
)
L
;
//LREGISTER(L, LUA_OSLIBNAME, oslib); // <------------- ???
//LREGISTER(L, LUA_OSLIBNAME, oslib); // <------------- ???
return
0
;
return
0
;
}
}
Write
Preview
Markdown
is supported
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