svn commit: r359678 - head/usr.bin/indent
Kyle Evans
kevans at FreeBSD.org
Mon Apr 6 23:20:21 UTC 2020
Author: kevans
Date: Mon Apr 6 23:20:20 2020
New Revision: 359678
URL: https://svnweb.freebsd.org/changeset/base/359678
Log:
indent: fix the -fno-common build
Spread the globals far and wide, hopefully to the files that make the most
sense.
-fno-common will become the default in GCC10/LLVM11.
MFC after: 3 days
Modified:
head/usr.bin/indent/indent.c
head/usr.bin/indent/indent_globs.h
head/usr.bin/indent/io.c
head/usr.bin/indent/parse.c
Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c Mon Apr 6 23:16:05 2020 (r359677)
+++ head/usr.bin/indent/indent.c Mon Apr 6 23:20:20 2020 (r359678)
@@ -59,6 +59,30 @@ __FBSDID("$FreeBSD$");
#include "indent_codes.h"
#include "indent.h"
+/* Globals */
+FILE *input, *output;
+char *labbuf, *s_lab, *e_lab, *l_lab;
+char *codebuf, *s_code, *e_code, *l_code;
+char *combuf, *s_com, *e_com, *l_com;
+char *tokenbuf, *s_token, *e_token, *l_token;
+char *in_buffer, *in_buffer_limit;
+char *buf_ptr, *buf_end;
+
+char sc_buf[sc_size];
+
+char *save_com, *sc_end;
+char *bp_save;
+char *be_save;
+
+struct options opt;
+int line_no;
+
+struct parser_state ps;
+int ifdef_level;
+struct parser_state state_stack[5];
+struct parser_state match_state[5];
+
+
static void bakcopy(void);
static void indent_declaration(int, int);
Modified: head/usr.bin/indent/indent_globs.h
==============================================================================
--- head/usr.bin/indent/indent_globs.h Mon Apr 6 23:16:05 2020 (r359677)
+++ head/usr.bin/indent/indent_globs.h Mon Apr 6 23:20:20 2020 (r359678)
@@ -49,8 +49,8 @@
#define true 1
-FILE *input; /* the fid for the input file */
-FILE *output; /* the output file */
+extern FILE *input; /* the fid for the input file */
+extern FILE *output; /* the output file */
#define CHECK_SIZE_CODE(desired_size) \
if (e_code + (desired_size) >= l_code) { \
@@ -104,41 +104,43 @@ FILE *output; /* the output file */
s_token = tokenbuf + 1; \
}
-char *labbuf; /* buffer for label */
-char *s_lab; /* start ... */
-char *e_lab; /* .. and end of stored label */
-char *l_lab; /* limit of label buffer */
+extern char *labbuf; /* buffer for label */
+extern char *s_lab; /* start ... */
+extern char *e_lab; /* .. and end of stored label */
+extern char *l_lab; /* limit of label buffer */
-char *codebuf; /* buffer for code section */
-char *s_code; /* start ... */
-char *e_code; /* .. and end of stored code */
-char *l_code; /* limit of code section */
+extern char *codebuf; /* buffer for code section */
+extern char *s_code; /* start ... */
+extern char *e_code; /* .. and end of stored code */
+extern char *l_code; /* limit of code section */
-char *combuf; /* buffer for comments */
-char *s_com; /* start ... */
-char *e_com; /* ... and end of stored comments */
-char *l_com; /* limit of comment buffer */
+extern char *combuf; /* buffer for comments */
+extern char *s_com; /* start ... */
+extern char *e_com; /* ... and end of stored comments */
+extern char *l_com; /* limit of comment buffer */
#define token s_token
-char *tokenbuf; /* the last token scanned */
-char *s_token;
-char *e_token;
-char *l_token;
+extern char *tokenbuf; /* the last token scanned */
+extern char *s_token;
+extern char *e_token;
+extern char *l_token;
-char *in_buffer; /* input buffer */
-char *in_buffer_limit; /* the end of the input buffer */
-char *buf_ptr; /* ptr to next character to be taken from
- * in_buffer */
-char *buf_end; /* ptr to first after last char in in_buffer */
+extern char *in_buffer; /* input buffer */
+extern char *in_buffer_limit; /* the end of the input buffer */
+extern char *buf_ptr; /* ptr to next character to be taken
+ * from in_buffer */
+extern char *buf_end; /* ptr to first after last char in
+ * in_buffer */
-char sc_buf[sc_size]; /* input text is saved here when looking for
- * the brace after an if, while, etc */
-char *save_com; /* start of the comment stored in sc_buf */
-char *sc_end; /* pointer into save_com buffer */
+extern char sc_buf[sc_size]; /* input text is saved here when looking
+ * for the brace after an if, while, etc */
+extern char *save_com; /* start of the comment stored in
+ * sc_buf */
+extern char *sc_end; /* pointer into save_com buffer */
-char *bp_save; /* saved value of buf_ptr when taking input
- * from save_com */
-char *be_save; /* similarly saved value of buf_end */
+extern char *bp_save; /* saved value of buf_ptr when taking
+ * input from save_com */
+extern char *be_save; /* similarly saved value of buf_end */
struct options {
@@ -217,21 +219,22 @@ struct options {
* uses all spaces */
int verbose; /* when true, non-essential error messages
* are printed */
-} opt;
+};
+extern struct options opt;
-int found_err;
-int n_real_blanklines;
-int prefix_blankline_requested;
-int postfix_blankline_requested;
-int break_comma; /* when true and not in parens, break after a
+extern int found_err;
+extern int n_real_blanklines;
+extern int prefix_blankline_requested;
+extern int postfix_blankline_requested;
+extern int break_comma; /* when true and not in parens, break after a
* comma */
-float case_ind; /* indentation level to be used for a "case
+extern float case_ind; /* indentation level to be used for a "case
* n:" */
-int code_lines; /* count of lines with code */
-int had_eof; /* set to true when input is exhausted */
-int line_no; /* the current line number. */
-int inhibit_formatting; /* true if INDENT OFF is in effect */
-int suppress_blanklines;/* set iff following blanklines should be
+extern int code_lines; /* count of lines with code */
+extern int had_eof; /* set to true when input is exhausted */
+extern int line_no; /* the current line number. */
+extern int inhibit_formatting; /* true if INDENT OFF is in effect */
+extern int suppress_blanklines;/* set iff following blanklines should be
* suppressed */
#define STACKSIZE 256
@@ -312,8 +315,10 @@ struct parser_state {
int tos; /* pointer to top of stack */
char procname[100]; /* The name of the current procedure */
int just_saw_decl;
-} ps;
+};
-int ifdef_level;
-struct parser_state state_stack[5];
-struct parser_state match_state[5];
+extern struct parser_state ps;
+
+extern int ifdef_level;
+extern struct parser_state state_stack[5];
+extern struct parser_state match_state[5];
Modified: head/usr.bin/indent/io.c
==============================================================================
--- head/usr.bin/indent/io.c Mon Apr 6 23:16:05 2020 (r359677)
+++ head/usr.bin/indent/io.c Mon Apr 6 23:20:20 2020 (r359678)
@@ -52,6 +52,15 @@ __FBSDID("$FreeBSD$");
#include "indent_globs.h"
#include "indent.h"
+/* Globals */
+int found_err;
+int n_real_blanklines;
+int prefix_blankline_requested, postfix_blankline_requested;
+int code_lines;
+int had_eof;
+int inhibit_formatting;
+int suppress_blanklines;
+
int comment_open;
static int paren_target;
static int pad_output(int current, int target);
Modified: head/usr.bin/indent/parse.c
==============================================================================
--- head/usr.bin/indent/parse.c Mon Apr 6 23:16:05 2020 (r359677)
+++ head/usr.bin/indent/parse.c Mon Apr 6 23:20:20 2020 (r359678)
@@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$");
#include "indent_codes.h"
#include "indent.h"
+/* Globals */
+int break_comma;
+float case_ind;
+
static void reduce(void);
void
More information about the svn-src-all
mailing list