This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
coding style, continuing education
- To: gcc at gcc dot gnu dot org
- Subject: coding style, continuing education
- From: Mike Stump <mrs at windriver dot com>
- Date: Mon, 15 Jan 2001 14:03:33 -0800 (PST)
I know that historically gcc has had thousand line functions, and
worse, but as time goes on we clean up the various sorts of code and
make it prettier. It is just like the line formatting rules, see a
line longer than 80, and one should just split on demand, not stopping
to think twice about if they should do it or not. I'm tracking down a
problem on an older compiler, and was traipsing around the code below.
Icky. I think it would help if people realize that this code is like
the > 80 character lines, one should just take a moment and split it
down. I think we should all just agree that conditionals that run on
past 20 or so lines should be split. Maybe we need a new gcc warning
when the opening ( and the closing ) are more than 20 lines apart, we
warn. We could also have a { } checker that will warn when they are
more than, say 2000 lines apart. Someone want to work on a useful
warning that will hit often? :-)
If people _know_ of a good way to split this down, maybe we all just
need a refresher course on the right way, care to elaborate?
if (mode1 == VOIDmode
|| GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG
|| (modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER
&& ((mode1 != BLKmode && ! direct_load[(int) mode1]
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
&& GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
/* If the field isn't aligned enough to fetch as a memref,
fetch it as a bit field. */
|| (mode1 != BLKmode
&& SLOW_UNALIGNED_ACCESS (mode1, alignment)
&& ((TYPE_ALIGN (TREE_TYPE (tem))
< GET_MODE_ALIGNMENT (mode))
|| (bitpos % GET_MODE_ALIGNMENT (mode) != 0)))
/* If the type and the field are a constant size and the
size of the type isn't the same size as the bitfield,
we must use bitfield operations. */
|| ((bitsize >= 0
&& (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp)))
== INTEGER_CST)
&& 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)),
bitsize)))))
|| (modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER
&& mode == BLKmode
&& SLOW_UNALIGNED_ACCESS (mode, alignment)
&& (TYPE_ALIGN (type) > alignment
|| bitpos % TYPE_ALIGN (type) != 0)))
{