mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +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:
@ -26,11 +26,6 @@ PG_MODULE_MAGIC;
|
||||
#define ARRPTR(x) ( (double *) ARR_DATA_PTR(x) )
|
||||
#define ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))
|
||||
|
||||
extern int cube_yyparse(NDBOX **result);
|
||||
extern void cube_yyerror(NDBOX **result, const char *message);
|
||||
extern void cube_scanner_init(const char *str);
|
||||
extern void cube_scanner_finish(void);
|
||||
|
||||
/*
|
||||
** Input/Output routines
|
||||
*/
|
||||
|
@ -46,3 +46,12 @@ typedef struct NDBOX
|
||||
#define DatumGetNDBOX(x) ((NDBOX *) PG_DETOAST_DATUM(x))
|
||||
#define PG_GETARG_NDBOX(x) DatumGetNDBOX(PG_GETARG_DATUM(x))
|
||||
#define PG_RETURN_NDBOX(x) PG_RETURN_POINTER(x)
|
||||
|
||||
/* in cubescan.l */
|
||||
extern int cube_yylex(void);
|
||||
extern void cube_yyerror(NDBOX **result, const char *message) pg_attribute_noreturn();
|
||||
extern void cube_scanner_init(const char *str);
|
||||
extern void cube_scanner_finish(void);
|
||||
|
||||
/* in cubeparse.y */
|
||||
extern int cube_yyparse(NDBOX **result);
|
||||
|
@ -22,14 +22,9 @@
|
||||
#define YYMALLOC palloc
|
||||
#define YYFREE pfree
|
||||
|
||||
extern int cube_yylex(void);
|
||||
|
||||
static char *scanbuf;
|
||||
static int scanbuflen;
|
||||
|
||||
extern int cube_yyparse(NDBOX **result);
|
||||
extern void cube_yyerror(NDBOX **result, const char *message);
|
||||
|
||||
static int delim_count(char *s, char delim);
|
||||
static NDBOX * write_box(unsigned int dim, char *str1, char *str2);
|
||||
static NDBOX * write_point_as_box(char *s, int dim);
|
||||
|
@ -4,8 +4,6 @@
|
||||
* contrib/cube/cubescan.l
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
/* No reason to constrain amount of data slurped */
|
||||
#define YY_READ_BUF_SIZE 16777216
|
||||
|
||||
@ -24,12 +22,6 @@ static YY_BUFFER_STATE scanbufhandle;
|
||||
/* this is now declared in cubeparse.y: */
|
||||
/* static char *scanbuf; */
|
||||
/* static int scanbuflen; */
|
||||
|
||||
/* flex 2.5.4 doesn't bother with a decl for this */
|
||||
int cube_yylex(void);
|
||||
|
||||
void cube_scanner_init(const char *str);
|
||||
void cube_scanner_finish(void);
|
||||
%}
|
||||
|
||||
%option 8bit
|
||||
@ -60,7 +52,7 @@ float ({integer}|{real})([eE]{integer})?
|
||||
|
||||
%%
|
||||
|
||||
void pg_attribute_noreturn
|
||||
void
|
||||
yyerror(NDBOX **result, const char *message)
|
||||
{
|
||||
if (*yytext == YY_END_OF_BUFFER_CHAR)
|
||||
|
Reference in New Issue
Block a user