Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4eca3f15
Commit
4eca3f15
authored
Oct 25, 2006
by
William Stein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change so that warning for multiple declarations are printed by default.
parent
23a07795
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
Cython/Compiler/Errors.py
Cython/Compiler/Errors.py
+5
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+7
-7
No files found.
Cython/Compiler/Errors.py
View file @
4eca3f15
...
@@ -88,7 +88,11 @@ def error(position, message):
...
@@ -88,7 +88,11 @@ def error(position, message):
num_errors
=
num_errors
+
1
num_errors
=
num_errors
+
1
return
err
return
err
def
warning
(
position
,
message
):
LEVEL
=
1
# warn about all errors level 1 or higher
def
warning
(
position
,
message
,
level
):
if
level
<
LEVEL
:
return
warn
=
CompileWarning
(
position
,
message
)
warn
=
CompileWarning
(
position
,
message
)
line
=
"warning: %s
\
n
"
%
warn
line
=
"warning: %s
\
n
"
%
warn
if
listing_file
:
if
listing_file
:
...
...
Cython/Compiler/Symtab.py
View file @
4eca3f15
...
@@ -195,7 +195,7 @@ class Scope:
...
@@ -195,7 +195,7 @@ class Scope:
# declared.
# declared.
dict
=
self
.
entries
dict
=
self
.
entries
if
name
and
dict
.
has_key
(
name
):
if
name
and
dict
.
has_key
(
name
):
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
,
0
)
entry
=
Entry
(
name
,
cname
,
type
,
pos
=
pos
)
entry
=
Entry
(
name
,
cname
,
type
,
pos
=
pos
)
entry
.
in_cinclude
=
self
.
in_cinclude
entry
.
in_cinclude
=
self
.
in_cinclude
if
name
:
if
name
:
...
@@ -243,9 +243,9 @@ class Scope:
...
@@ -243,9 +243,9 @@ class Scope:
self
.
sue_entries
.
append
(
entry
)
self
.
sue_entries
.
append
(
entry
)
else
:
else
:
if
not
(
entry
.
is_type
and
entry
.
type
.
is_struct_or_union
):
if
not
(
entry
.
is_type
and
entry
.
type
.
is_struct_or_union
):
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
,
0
)
elif
scope
and
entry
.
type
.
scope
:
elif
scope
and
entry
.
type
.
scope
:
warning
(
pos
,
"'%s' already defined (ignoring second definition)"
%
name
)
warning
(
pos
,
"'%s' already defined (ignoring second definition)"
%
name
,
0
)
else
:
else
:
self
.
check_previous_typedef_flag
(
entry
,
typedef_flag
,
pos
)
self
.
check_previous_typedef_flag
(
entry
,
typedef_flag
,
pos
)
if
scope
:
if
scope
:
...
@@ -556,7 +556,7 @@ class ModuleScope(Scope):
...
@@ -556,7 +556,7 @@ class ModuleScope(Scope):
if
entry
not
in
self
.
entries
:
if
entry
not
in
self
.
entries
:
self
.
entries
[
name
]
=
entry
self
.
entries
[
name
]
=
entry
else
:
else
:
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
,
0
)
def
declare_module
(
self
,
name
,
scope
,
pos
):
def
declare_module
(
self
,
name
,
scope
,
pos
):
# Declare a cimported module. This is represented as a
# Declare a cimported module. This is represented as a
...
@@ -574,7 +574,7 @@ class ModuleScope(Scope):
...
@@ -574,7 +574,7 @@ class ModuleScope(Scope):
# name to appear again, and indeed the generated
# name to appear again, and indeed the generated
# code compiles fine.
# code compiles fine.
return
entry
return
entry
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
,
0
)
return
None
return
None
else
:
else
:
entry
=
self
.
declare_var
(
name
,
py_object_type
,
pos
)
entry
=
self
.
declare_var
(
name
,
py_object_type
,
pos
)
...
@@ -822,7 +822,7 @@ class LocalScope(Scope):
...
@@ -822,7 +822,7 @@ class LocalScope(Scope):
def
declare_global
(
self
,
name
,
pos
):
def
declare_global
(
self
,
name
,
pos
):
# Pull entry from global scope into local scope.
# Pull entry from global scope into local scope.
if
self
.
lookup_here
(
name
):
if
self
.
lookup_here
(
name
):
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
,
0
)
else
:
else
:
entry
=
self
.
global_scope
().
lookup_target
(
name
)
entry
=
self
.
global_scope
().
lookup_target
(
name
)
self
.
entries
[
name
]
=
entry
self
.
entries
[
name
]
=
entry
...
@@ -996,7 +996,7 @@ class CClassScope(ClassScope):
...
@@ -996,7 +996,7 @@ class CClassScope(ClassScope):
entry
=
self
.
lookup_here
(
name
)
entry
=
self
.
lookup_here
(
name
)
if
entry
:
if
entry
:
if
not
entry
.
is_cfunction
:
if
not
entry
.
is_cfunction
:
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
)
warning
(
pos
,
"'%s' redeclared (ignoring second declaration)"
%
name
,
0
)
else
:
else
:
if
defining
and
entry
.
func_cname
:
if
defining
and
entry
.
func_cname
:
error
(
pos
,
"'%s' already defined"
%
name
)
error
(
pos
,
"'%s' already defined"
%
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment