mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 18:44:27 +02:00
Fix error with conflicting declaration of a prototype (Arduino sketch preprocessor)
This commit is contained in:
@@ -16,6 +16,7 @@ PlatformIO 3.0
|
||||
3.6.6 (2019-??-??)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Fixed error with conflicting declaration of a prototype (Arduino sketch preprocessor)
|
||||
* Fixed "FileExistsError" when `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ command is used in pair with ``--keep-build-dir`` option
|
||||
|
||||
3.6.5 (2019-03-07)
|
||||
|
@@ -33,10 +33,10 @@ class InoToCPPConverter(object):
|
||||
PROTOTYPE_RE = re.compile(
|
||||
r"""^(
|
||||
(?:template\<.*\>\s*)? # template
|
||||
([a-z_\d\&]+\*?\s+){1,2} # return type
|
||||
([a-z_\d\&]+\*?\s+){1,2} # return type
|
||||
([a-z_\d]+\s*) # name of prototype
|
||||
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
|
||||
)\s*\{ # must end with {
|
||||
)\s*(\{|;) # must end with `{` or `;`
|
||||
""", re.X | re.M | re.I)
|
||||
DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I)
|
||||
PROTOPTRS_TPLRE = r"\([^&\(]*&(%s)[^\)]*\)"
|
||||
@@ -161,6 +161,13 @@ class InoToCPPConverter(object):
|
||||
if not prototypes:
|
||||
return contents
|
||||
|
||||
# skip already declared prototypes
|
||||
declared = set(
|
||||
m.group(1).strip() for m in prototypes if m.group(4) == ";")
|
||||
prototypes = [
|
||||
m for m in prototypes if m.group(1).strip() not in declared
|
||||
]
|
||||
|
||||
prototype_names = set(m.group(3).strip() for m in prototypes)
|
||||
split_pos = prototypes[0].start()
|
||||
match_ptrs = re.search(
|
||||
|
@@ -49,4 +49,12 @@ void fooCallback(){
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
void some_extern(const char *fmt, ...);
|
||||
};
|
||||
|
||||
void some_extern(const char *fmt, ...) {
|
||||
|
||||
}
|
||||
|
||||
// юнікод
|
||||
|
Reference in New Issue
Block a user