mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Tweak __attribute__-wrapping macros for better pgindent results.
This improves on commit bbfd7edae5
by
making two simple changes:
* pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn().
Likewise pg_attribute_unused(), pg_attribute_packed(). This reduces
pgindent's tendency to misformat declarations involving them.
* attributes are now always attached to function declarations, not
definitions. Previously some places were taking creative shortcuts,
which were not merely candidates for bad misformatting by pgindent
but often were outright wrong anyway. (It does little good to put a
noreturn annotation where callers can't see it.) In any case, if
we would like to believe that these macros can be used with non-gcc
compilers, we should avoid gratuitous variance in usage patterns.
I also went through and manually improved the formatting of a lot of
declarations, and got rid of excessively repetitive (and now obsolete
anyway) comments informing the reader what pg_attribute_printf is for.
This commit is contained in:
@ -23,15 +23,6 @@
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
extern int seg_yyparse(SEG *result);
|
||||
extern void seg_yyerror(SEG *result, const char *message);
|
||||
extern void seg_scanner_init(const char *str);
|
||||
extern void seg_scanner_finish(void);
|
||||
|
||||
/*
|
||||
extern int seg_yydebug;
|
||||
*/
|
||||
|
||||
/*
|
||||
* Auxiliary data structure for picksplit method.
|
||||
*/
|
||||
@ -103,7 +94,6 @@ bool seg_different(SEG *a, SEG *b);
|
||||
** Auxiliary funxtions
|
||||
*/
|
||||
static int restore(char *s, float val, int n);
|
||||
int significant_digits(char *s);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -10,3 +10,15 @@ typedef struct SEG
|
||||
char l_ext;
|
||||
char u_ext;
|
||||
} SEG;
|
||||
|
||||
/* in seg.c */
|
||||
extern int significant_digits(char *str);
|
||||
|
||||
/* in segscan.l */
|
||||
extern int seg_yylex(void);
|
||||
extern void seg_yyerror(SEG *result, const char *message) pg_attribute_noreturn();
|
||||
extern void seg_scanner_init(const char *str);
|
||||
extern void seg_scanner_finish(void);
|
||||
|
||||
/* in segparse.y */
|
||||
extern int seg_yyparse(SEG *result);
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
#include "segdata.h"
|
||||
|
||||
/*
|
||||
@ -20,13 +21,6 @@
|
||||
#define YYMALLOC palloc
|
||||
#define YYFREE pfree
|
||||
|
||||
extern int seg_yylex(void);
|
||||
|
||||
extern int significant_digits(char *str); /* defined in seg.c */
|
||||
|
||||
extern int seg_yyparse(SEG *result);
|
||||
extern void seg_yyerror(SEG *result, const char *message);
|
||||
|
||||
static float seg_atof(char *value);
|
||||
|
||||
static char strbuf[25] = {
|
||||
|
@ -3,8 +3,6 @@
|
||||
* A scanner for EMP-style numeric ranges
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
/* No reason to constrain amount of data slurped */
|
||||
#define YY_READ_BUF_SIZE 16777216
|
||||
|
||||
@ -22,12 +20,6 @@ fprintf_to_ereport(const char *fmt, const char *msg)
|
||||
static YY_BUFFER_STATE scanbufhandle;
|
||||
static char *scanbuf;
|
||||
static int scanbuflen;
|
||||
|
||||
/* flex 2.5.4 doesn't bother with a decl for this */
|
||||
int seg_yylex(void);
|
||||
|
||||
void seg_scanner_init(const char *str);
|
||||
void seg_scanner_finish(void);
|
||||
%}
|
||||
|
||||
%option 8bit
|
||||
@ -59,7 +51,7 @@ float ({integer}|{real})([eE]{integer})?
|
||||
|
||||
%%
|
||||
|
||||
void pg_attribute_noreturn
|
||||
void
|
||||
yyerror(SEG *result, const char *message)
|
||||
{
|
||||
if (*yytext == YY_END_OF_BUFFER_CHAR)
|
||||
|
Reference in New Issue
Block a user