Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-32150: Expand tabs to spaces in C files.#4583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
serhiy-storchaka merged 2 commits intopython:masterfromserhiy-storchaka:expand-tabs
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionDoc/includes/shoddy.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ Shoddy_increment(Shoddy *self, PyObject *unused)
static PyMethodDef Shoddy_methods[] = {
{"increment", (PyCFunction)Shoddy_increment, METH_NOARGS,
PyDoc_STR("increment state counter")},
{NULL,NULL},
{NULL},
};

static int
Expand Down
14 changes: 7 additions & 7 deletionsInclude/bitset.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@ extern "C" {

/* Bitset interface */

#define BYTEchar
#define BYTEchar

typedef BYTE *bitset;

Expand All@@ -18,13 +18,13 @@ int addbit(bitset bs, int ibit); /* Returns 0 if already set */
int samebitset(bitset bs1, bitset bs2, int nbits);
void mergebitset(bitset bs1, bitset bs2, int nbits);

#define BITSPERBYTE(8*sizeof(BYTE))
#define NBYTES(nbits)(((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
#define BITSPERBYTE(8*sizeof(BYTE))
#define NBYTES(nbits)(((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)

#define BIT2BYTE(ibit)((ibit) / BITSPERBYTE)
#define BIT2SHIFT(ibit)((ibit) % BITSPERBYTE)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Here tabs make the view on GitHub uglier. See at left side.

#define BIT2MASK(ibit)(1 << BIT2SHIFT(ibit))
#define BYTE2BIT(ibyte)((ibyte) * BITSPERBYTE)
#define BIT2BYTE(ibit)((ibit) / BITSPERBYTE)
#define BIT2SHIFT(ibit)((ibit) % BITSPERBYTE)
#define BIT2MASK(ibit)(1 << BIT2SHIFT(ibit))
#define BYTE2BIT(ibyte)((ibyte) * BITSPERBYTE)

#ifdef __cplusplus
}
Expand Down
14 changes: 7 additions & 7 deletionsInclude/bytesobject.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -52,9 +52,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
Expand All@@ -72,8 +72,8 @@ PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
int use_bytearray);
#endif
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Wrong alignment due to tabs.

const char *);
const char *, Py_ssize_t,
const char *);
#ifndef Py_LIMITED_API
/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
Expand DownExpand Up@@ -132,10 +132,10 @@ PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,

/* Flags used by string formatting */
#define F_LJUST (1<<0)
#define F_SIGN(1<<1)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces make worser a view on GitHub.

#define F_SIGN(1<<1)
#define F_BLANK (1<<2)
#define F_ALT(1<<3)
#define F_ZERO(1<<4)
#define F_ALT(1<<3)
#define F_ZERO(1<<4)

#ifndef Py_LIMITED_API
/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
Expand Down
4 changes: 2 additions & 2 deletionsInclude/cellobject.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,8 @@ extern "C" {
#endif

typedef struct {
PyObject_HEAD
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Too larger indent.

PyObject *ob_ref;/* Content of the cell or NULL when empty */
PyObject_HEAD
PyObject *ob_ref;/* Content of the cell or NULL when empty */
} PyCellObject;

PyAPI_DATA(PyTypeObject) PyCell_Type;
Expand Down
6 changes: 3 additions & 3 deletionsInclude/classobject.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,13 +30,13 @@ PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
#definePyMethod_GET_FUNCTION(meth) \
(((PyMethodObject *)meth) -> im_func)
#definePyMethod_GET_SELF(meth) \
(((PyMethodObject *)meth) -> im_self)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces (compare with lines above).

(((PyMethodObject *)meth) -> im_self)

PyAPI_FUNC(int)PyMethod_ClearFreeList(void);

typedefstruct {
PyObject_HEAD
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Too larger indent.

PyObject*func;
PyObject_HEAD
PyObject*func;
}PyInstanceMethodObject;

PyAPI_DATA(PyTypeObject)PyInstanceMethod_Type;
Expand Down
48 changes: 24 additions & 24 deletionsInclude/code.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,29 +20,29 @@ typedef uint16_t _Py_CODEUNIT;
/* Bytecode object */
typedef struct {
PyObject_HEAD
int co_argcount;/* #arguments, except *args */
int co_kwonlyargcount;/* #keyword only arguments */
int co_nlocals;/* #local variables */
int co_stacksize;/* #entries needed for evaluation stack */
int co_flags;/* CO_..., see below */
int co_firstlineno; /* first source line number */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.

PyObject *co_code;/* instruction opcodes */
PyObject *co_consts;/* list (constants used) */
PyObject *co_names;/* list of strings (names used) */
PyObject *co_varnames;/* tuple of strings (local variable names) */
PyObject *co_freevars;/* tuple of strings (free variable names) */
int co_argcount;/* #arguments, except *args */
int co_kwonlyargcount;/* #keyword only arguments */
int co_nlocals;/* #local variables */
int co_stacksize;/* #entries needed for evaluation stack */
int co_flags;/* CO_..., see below */
int co_firstlineno;/* first source line number */
PyObject *co_code;/* instruction opcodes */
PyObject *co_consts;/* list (constants used) */
PyObject *co_names;/* list of strings (names used) */
PyObject *co_varnames;/* tuple of strings (local variable names) */
PyObject *co_freevars;/* tuple of strings (free variable names) */
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
/* The rest aren't used in either hash or comparisons, except for co_name,
used in both. This is done to preserve the name and line number
for tracebacks and debuggers; otherwise, constant de-duplication
would collapse identical functions/lambdas defined on different lines.
*/
Py_ssize_t *co_cell2arg; /* Maps cell vars which are arguments. */
PyObject *co_filename;/* unicode (where it was loaded from) */
PyObject *co_name;/* unicode (name, for reference) */
PyObject *co_lnotab;/* string (encoding addr<->lineno mapping) See
Objects/lnotab_notes.txt for details. */
void *co_zombieframe; /* for optimization only (see frameobject.c) */
PyObject *co_filename;/* unicode (where it was loaded from) */
PyObject *co_name;/* unicode (name, for reference) */
PyObject *co_lnotab;/* string (encoding addr<->lineno mapping) See
Objects/lnotab_notes.txt for details. */
void *co_zombieframe;/* for optimization only (see frameobject.c) */
PyObject *co_weakreflist; /* to support weakrefs to code objects */
/* Scratch space for extra data relating to the code object.
Type is a void* to keep the format private in codeobject.c to force
Expand All@@ -51,10 +51,10 @@ typedef struct {
} PyCodeObject;

/* Masks for co_flags above */
#define CO_OPTIMIZED0x0001
#define CO_NEWLOCALS0x0002
#define CO_VARARGS0x0004
#define CO_VARKEYWORDS0x0008
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.

#define CO_OPTIMIZED0x0001
#define CO_NEWLOCALS0x0002
#define CO_VARARGS0x0004
#define CO_VARKEYWORDS0x0008
#define CO_NESTED 0x0010
#define CO_GENERATOR 0x0020
/* The CO_NOFREE flag is set if there are no free or cell variables.
Expand All@@ -74,7 +74,7 @@ typedef struct {
#if 0
#define CO_GENERATOR_ALLOWED 0x1000
#endif
#define CO_FUTURE_DIVISION0x2000
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.

#define CO_FUTURE_DIVISION0x2000
#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */
#define CO_FUTURE_WITH_STATEMENT 0x8000
#define CO_FUTURE_PRINT_FUNCTION 0x10000
Expand All@@ -101,9 +101,9 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;

/* Public interface */
PyAPI_FUNC(PyCodeObject *) PyCode_New(
int, int, int, int, int, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, int, PyObject *);
int, int, int, int, int, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, int, PyObject *);
/* same as struct above */

/* Creates a new empty code object with the specified source location. */
Expand Down
34 changes: 17 additions & 17 deletionsInclude/errcode.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,24 +13,24 @@ extern "C" {
the parser only returns E_EOF when it hits EOF immediately, and it
never returns E_OK. */

#define E_OK10/* No error */
#define E_EOF11/* End Of File */
#define E_INTR12/* Interrupted */
#define E_TOKEN13/* Bad token */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

#define E_SYNTAX14/* Syntax error */
#define E_NOMEM15/* Ran out of memory */
#define E_DONE16/* Parsing complete */
#define E_ERROR17/* Execution error */
#define E_TABSPACE18/* Inconsistent mixing of tabs and spaces */
#define E_OVERFLOW 19/* Node had too many children */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.

#define E_TOODEEP20/* Too many indentation levels */
#define E_DEDENT21/* No matching outer block for dedent */
#define E_DECODE22/* Error in decoding into Unicode */
#define E_EOFS23/* EOF in triple-quoted string */
#define E_EOLS24/* EOL in single-quoted string */
#define E_LINECONT25/* Unexpected characters after a line continuation */
#define E_OK 10/* No error */
#define E_EOF 11/* End Of File */
#define E_INTR 12/* Interrupted */
#define E_TOKEN 13/* Bad token */
#define E_SYNTAX 14/* Syntax error */
#define E_NOMEM 15/* Ran out of memory */
#define E_DONE 16/* Parsing complete */
#define E_ERROR 17/* Execution error */
#define E_TABSPACE 18/* Inconsistent mixing of tabs and spaces */
#define E_OVERFLOW 19/* Node had too many children */
#define E_TOODEEP 20/* Too many indentation levels */
#define E_DEDENT 21/* No matching outer block for dedent */
#define E_DECODE 22/* Error in decoding into Unicode */
#define E_EOFS 23/* EOF in triple-quoted string */
#define E_EOLS 24/* EOL in single-quoted string */
#define E_LINECONT 25/* Unexpected characters after a line continuation */
#define E_IDENTIFIER 26 /* Invalid characters in identifier */
#define E_BADSINGLE27/* Ill-formed single statement input */
#define E_BADSINGLE 27/* Ill-formed single statement input */

#ifdef __cplusplus
}
Expand Down
34 changes: 17 additions & 17 deletionsInclude/funcobject.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,17 +20,17 @@ extern "C" {

typedef struct {
PyObject_HEAD
PyObject *func_code;/* A code object, the __code__ attribute */
PyObject *func_globals;/* A dictionary (other mappings won't do) */
PyObject *func_defaults;/* NULL or a tuple */
PyObject *func_kwdefaults;/* NULL or a dict */
PyObject *func_closure;/* NULL or a tuple of cell objects */
PyObject *func_doc;/* The __doc__ attribute, can be anything */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

PyObject *func_name;/* The __name__ attribute, a string object */
PyObject *func_dict;/* The __dict__ attribute, a dict or NULL */
PyObject *func_weakreflist;/* List of weak references */
PyObject *func_module;/* The __module__ attribute, can be anything */
PyObject *func_annotations;/* Annotations, a dict or NULL */
PyObject *func_code;/* A code object, the __code__ attribute */
PyObject *func_globals;/* A dictionary (other mappings won't do) */
PyObject *func_defaults;/* NULL or a tuple */
PyObject *func_kwdefaults;/* NULL or a dict */
PyObject *func_closure;/* NULL or a tuple of cell objects */
PyObject *func_doc;/* The __doc__ attribute, can be anything */
PyObject *func_name;/* The __name__ attribute, a string object */
PyObject *func_dict;/* The __dict__ attribute, a dict or NULL */
PyObject *func_weakreflist;/* List of weak references */
PyObject *func_module;/* The __module__ attribute, can be anything */
PyObject *func_annotations;/* Annotations, a dict or NULL */
PyObject *func_qualname; /* The qualified name */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.


/* Invariant:
Expand DownExpand Up@@ -77,17 +77,17 @@ PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords(
#define PyFunction_GET_CODE(func) \
(((PyFunctionObject *)func) -> func_code)
#define PyFunction_GET_GLOBALS(func) \
(((PyFunctionObject *)func) -> func_globals)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mixed tabs and spaces.

(((PyFunctionObject *)func) -> func_globals)
#define PyFunction_GET_MODULE(func) \
(((PyFunctionObject *)func) -> func_module)
(((PyFunctionObject *)func) -> func_module)
#define PyFunction_GET_DEFAULTS(func) \
(((PyFunctionObject *)func) -> func_defaults)
(((PyFunctionObject *)func) -> func_defaults)
#define PyFunction_GET_KW_DEFAULTS(func) \
(((PyFunctionObject *)func) -> func_kwdefaults)
(((PyFunctionObject *)func) -> func_kwdefaults)
#define PyFunction_GET_CLOSURE(func) \
(((PyFunctionObject *)func) -> func_closure)
(((PyFunctionObject *)func) -> func_closure)
#define PyFunction_GET_ANNOTATIONS(func) \
(((PyFunctionObject *)func) -> func_annotations)
(((PyFunctionObject *)func) -> func_annotations)

/* The classmethod and staticmethod types lives here, too */
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
Expand Down
48 changes: 24 additions & 24 deletionsInclude/grammar.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,58 +12,58 @@ extern "C" {
/* A label of an arc */

typedef struct {
int lb_type;
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

char*lb_str;
int lb_type;
char*lb_str;
} label;

#define EMPTY 0/* Label number 0 is by definition the empty label */
#define EMPTY 0/* Label number 0 is by definition the empty label */

/* A list of labels */

typedef struct {
int ll_nlabels;
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

label*ll_label;
int ll_nlabels;
label*ll_label;
} labellist;

/* An arc from one state to another */

typedef struct {
shorta_lbl;/* Label of this arc */
shorta_arrow;/* State where this arc goes to */
shorta_lbl;/* Label of this arc */
shorta_arrow;/* State where this arc goes to */
} arc;

/* A state in a DFA */

typedef struct {
int s_narcs;
arc*s_arc;/* Array of arcs */
int s_narcs;
arc*s_arc;/* Array of arcs */

/* Optional accelerators */
ints_lower;/* Lowest label index */
ints_upper;/* Highest label index */
int*s_accel;/* Accelerator */
ints_accept;/* Nonzero for accepting state */
ints_lower;/* Lowest label index */
ints_upper;/* Highest label index */
int*s_accel;/* Accelerator */
ints_accept;/* Nonzero for accepting state */
} state;

/* A DFA */

typedef struct {
intd_type;/* Non-terminal this represents */
char*d_name;/* For printing */
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

intd_initial;/* Initial state */
int d_nstates;
state*d_state;/* Array of states */
bitset d_first;
intd_type;/* Non-terminal this represents */
char*d_name;/* For printing */
intd_initial;/* Initial state */
int d_nstates;
state*d_state;/* Array of states */
bitset d_first;
} dfa;

/* A grammar */

typedef struct {
int g_ndfas;
dfa*g_dfa;/* Array of DFAs */
labellist g_ll;
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bad alignment in the GitHub view.

intg_start;/* Start symbol of the grammar */
intg_accel;/* Set if accelerators present */
int g_ndfas;
dfa*g_dfa;/* Array of DFAs */
labellist g_ll;
intg_start;/* Start symbol of the grammar */
intg_accel;/* Set if accelerators present */
} grammar;

/* FUNCTIONS */
Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp