Commit graph

14 commits

Author SHA1 Message Date
Kp 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 9cb24b0d4a Use array<> for memdebug data 2016-10-29 23:16:15 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp b35a893d9a Rewrite simple pointer casts from C style to reinterpret_cast<>
s/(\s*\(\w\+\s*\*\+\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-07-03 00:54:15 +00:00
Kp 1b12a3f7ef Add parentheses around target of more complicated casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of some C casts.

This pass attempts to process expressions that involve parenthesized or
bracketed subexpressions, but only if those subexpressions do not
themselves contain parenthesized or bracketed subexpressions.

	(int) f(1);	// changed
	(int) f(g());	// not changed

perl -p -i -e 's/(\(\s*((?:un)?signed|int|char|short|long|float|double|s?size_t|(?:u?int[[:digit:]]+_t))\s*\**\s*\)\s*)([&+-]?)([[:alnum:]_.]+\s*->\s*)*([[:alnum:]_.]+)((?:\s*(?:\[[^][]*\])*|(?:\([^()]*\))*))(\s*([;+>*\/^%,|&<>])|$|(\s*-\s*[^>]))/\1\(\3\4\5\6\)\7/g'
2016-06-12 03:45:37 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\*\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 463ed96b4b Use inline namespace dcx for common/mem 2015-12-05 22:57:24 +00:00
Kp fa9f2e626d Move DbgShowMemInfo to CArg
Members of Arg are not visible to common code, so common/mem/mem.cpp
broke during the -Wodr cleanup.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/114>
Fixes: 6bd93e466f ("Guard args.h for LTO -Wodr")
2015-08-11 03:05:55 +00:00
Kp 82e1ea5636 Move similar/mem/mem.cpp -> common/mem/mem.cpp 2015-07-18 21:01:56 +00:00