Annotation of src/tests/usr.bin/indent/token_comma.c, Revision 1.1
1.1 ! rillig 1: /* $NetBSD: token-comma.0,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
! 2: /* $FreeBSD$ */
! 3:
! 4: /*
! 5: * Tests for the comma, which is used in the following contexts:
! 6: *
! 7: * The binary operator ',' inserts a sequence point between the evaluation of
! 8: * its operands.
! 9: *
! 10: * The parameters of a function declaration or a macro definition are
! 11: * separated by a comma.
! 12: *
! 13: * The arguments of a function call expression or a macro invocation are
! 14: * separated by a comma.
! 15: */
! 16:
! 17: #indent input
! 18: int
! 19: comma_expression(void)
! 20: {
! 21: return 1,3;
! 22: return a=b,c=d;
! 23: }
! 24: #indent end
! 25:
! 26: #indent run
! 27: int
! 28: comma_expression(void)
! 29: {
! 30: return 1, 3;
! 31: return a = b, c = d;
! 32: }
! 33: #indent end
! 34:
! 35: /*
! 36: * A comma that occurs at the beginning of a line is probably part of an
! 37: * initializer list, placed there for alignment.
! 38: */
! 39: #indent input
! 40: int
! 41: comma_at_beginning_of_line(void)
! 42: {
! 43: return 1,
! 44: 3;
! 45: return 1
! 46: ,3;
! 47: }
! 48: #indent end
! 49:
! 50: #indent run -ci4
! 51: int
! 52: comma_at_beginning_of_line(void)
! 53: {
! 54: return 1,
! 55: 3;
! 56: return 1
! 57: ,3;
! 58: }
! 59: #indent end
CVSweb <webmaster@jp.NetBSD.org>