summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent/parse.c
diff options
context:
space:
mode:
authorschweikh <schweikh@FreeBSD.org>2001-10-28 18:35:32 +0000
committerschweikh <schweikh@FreeBSD.org>2001-10-28 18:35:32 +0000
commitff38fb0e7374ef63944abf0515667857eaa6d61d (patch)
tree6313506ef1f3566b1b2f1a39f9d191e935e0f8bf /usr.bin/indent/parse.c
parent9b2eb27d345f3db1323f41df8b2ca6995de7e001 (diff)
downloadFreeBSD-src-ff38fb0e7374ef63944abf0515667857eaa6d61d.zip
FreeBSD-src-ff38fb0e7374ef63944abf0515667857eaa6d61d.tar.gz
Make this compile cleanly when warnings are enabled:
- ANSIfy function declarations - braces around initializers structs within structs - add parens in complicated expressions - disambiguate dangling elses - no more implicit int - make functions static where possible - use prototypes - don't use varargs hack for diag() Requested by: joerg MFC after: 2 weeks
Diffstat (limited to 'usr.bin/indent/parse.c')
-rw-r--r--usr.bin/indent/parse.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c
index da8b4a6..c87d1d4 100644
--- a/usr.bin/indent/parse.c
+++ b/usr.bin/indent/parse.c
@@ -32,19 +32,23 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
+#if 0
#ifndef lint
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
+#endif
#include <stdio.h>
#include "indent_globs.h"
#include "indent_codes.h"
+#include "indent.h"
-parse(tk)
- int tk; /* the code for the construct scanned */
+static void reduce(void);
+
+void
+parse(int tk) /* tk: the code for the construct scanned */
{
int i;
@@ -145,7 +149,7 @@ parse(tk)
case elselit: /* scanned an else */
if (ps.p_stack[ps.tos] != ifhead)
- diag(1, "Unmatched 'else'");
+ diag2(1, "Unmatched 'else'");
else {
ps.ind_level = ps.il[ps.tos]; /* indentation for else should
* be same as for if */
@@ -164,7 +168,7 @@ parse(tk)
ps.p_stack[ps.tos] = stmt;
}
else
- diag(1, "Stmt nesting error.");
+ diag2(1, "Stmt nesting error.");
break;
case swstmt: /* had switch (...) */
@@ -188,7 +192,7 @@ parse(tk)
break;
default: /* this is an error */
- diag(1, "Unknown code to parser");
+ diag2(1, "Unknown code to parser");
return;
@@ -244,9 +248,9 @@ parse(tk)
/*----------------------------------------------*\
| REDUCTION PHASE |
\*----------------------------------------------*/
-reduce()
+static void
+reduce(void)
{
-
register int i;
for (;;) { /* keep looping until there is nothing left to
OpenPOWER on IntegriCloud