Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cpplint warnings #946

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
@@ -0,0 +1,8 @@
{
"name": "My Custom Codespace",
"dockerFile": "../Dockerfile",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": []
}
1 change: 1 addition & 0 deletions Dockerfile
@@ -0,0 +1 @@
FROM ubuntu:latest
4 changes: 2 additions & 2 deletions docs.md
Expand Up @@ -474,13 +474,13 @@ no_includes = false
#
# #ifdef __cplusplus
# extern "C" {
# #endif // __cplusplus
# #endif // __cplusplus
#
# // Generated functions.
#
# #ifdef __cplusplus
# } // extern "C"
# #endif // __cplusplus
# #endif // __cplusplus
#
# If the language is not C this option won't have any effect.
#
Expand Down
4 changes: 2 additions & 2 deletions src/bindgen/ir/enumeration.rs
Expand Up @@ -668,7 +668,7 @@ impl Enum {
out.new_line();
write!(out, " : {}", prim);
out.new_line();
out.write("#endif // __cplusplus");
out.write("#endif // __cplusplus");
out.new_line();
}
} else {
Expand Down Expand Up @@ -756,7 +756,7 @@ impl Enum {

if config.cpp_compatible_c() {
out.new_line_if_not_start();
out.write("#endif // __cplusplus");
out.write("#endif // __cplusplus");
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/bindgen/language_backend/clike.rs
Expand Up @@ -101,13 +101,13 @@ impl<'a> CLikeLanguageBackend<'a> {
if open {
write!(out, "namespace {} {{", namespace)
} else {
write!(out, "}} // namespace {}", namespace)
write!(out, "}} // namespace {}", namespace)
}
}

out.new_line();
if self.config.cpp_compatible_c() {
out.write("#endif // __cplusplus");
out.write("#endif // __cplusplus");
out.new_line();
}
}
Expand Down Expand Up @@ -457,9 +457,9 @@ impl LanguageBackend for CLikeLanguageBackend<'_> {
if let Some(f) = self.config.include_guard() {
out.new_line_if_not_start();
if self.config.language == Language::C {
write!(out, "#endif /* {} */", f);
write!(out, "#endif /* {} */", f);
} else {
write!(out, "#endif // {}", f);
write!(out, "#endif // {}", f);
}
out.new_line();
}
Expand Down Expand Up @@ -963,7 +963,7 @@ impl LanguageBackend for CLikeLanguageBackend<'_> {
}

if b.config.cpp_compatible_c() {
out.write("#endif // __cplusplus");
out.write("#endif // __cplusplus");
out.new_line();
}

Expand All @@ -984,12 +984,12 @@ impl LanguageBackend for CLikeLanguageBackend<'_> {

if b.config.language == Language::Cxx || b.config.cpp_compatible_c() {
out.new_line();
out.write("} // extern \"C\"");
out.write("} // extern \"C\"");
out.new_line();
}

if b.config.cpp_compatible_c() {
out.write("#endif // __cplusplus");
out.write("#endif // __cplusplus");
out.new_line();
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/abi_string.compat.c
Expand Up @@ -5,12 +5,12 @@

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void c(void);

void c_unwind(void);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
8 changes: 4 additions & 4 deletions tests/expectations/alias.compat.c
Expand Up @@ -6,14 +6,14 @@
enum Status
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
Ok,
Err,
};
#ifndef __cplusplus
typedef uint32_t Status;
#endif // __cplusplus
#endif // __cplusplus

typedef struct {
int32_t a;
Expand Down Expand Up @@ -42,10 +42,10 @@ typedef Status SpecialStatus;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
8 changes: 4 additions & 4 deletions tests/expectations/alias_both.compat.c
Expand Up @@ -6,14 +6,14 @@
enum Status
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
Ok,
Err,
};
#ifndef __cplusplus
typedef uint32_t Status;
#endif // __cplusplus
#endif // __cplusplus

typedef struct Dep {
int32_t a;
Expand Down Expand Up @@ -42,10 +42,10 @@ typedef Status SpecialStatus;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
8 changes: 4 additions & 4 deletions tests/expectations/alias_tag.compat.c
Expand Up @@ -6,14 +6,14 @@
enum Status
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
Ok,
Err,
};
#ifndef __cplusplus
typedef uint32_t Status;
#endif // __cplusplus
#endif // __cplusplus

struct Dep {
int32_t a;
Expand Down Expand Up @@ -42,10 +42,10 @@ typedef Status SpecialStatus;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
16 changes: 8 additions & 8 deletions tests/expectations/annotation.compat.c
Expand Up @@ -6,14 +6,14 @@
enum C
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
X = 2,
Y,
};
#ifndef __cplusplus
typedef uint32_t C;
#endif // __cplusplus
#endif // __cplusplus

typedef struct {
int32_t m0;
Expand All @@ -27,15 +27,15 @@ typedef struct {
enum F_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Foo,
Bar,
Baz,
};
#ifndef __cplusplus
typedef uint8_t F_Tag;
#endif // __cplusplus
#endif // __cplusplus

typedef struct {
F_Tag tag;
Expand All @@ -55,15 +55,15 @@ typedef union {
enum H_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Hello,
There,
Everyone,
};
#ifndef __cplusplus
typedef uint8_t H_Tag;
#endif // __cplusplus
#endif // __cplusplus

typedef struct {
uint8_t x;
Expand All @@ -82,10 +82,10 @@ typedef struct {

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(A x, B y, C z, F f, H h);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
16 changes: 8 additions & 8 deletions tests/expectations/annotation_both.compat.c
Expand Up @@ -6,14 +6,14 @@
enum C
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
X = 2,
Y,
};
#ifndef __cplusplus
typedef uint32_t C;
#endif // __cplusplus
#endif // __cplusplus

typedef struct A {
int32_t m0;
Expand All @@ -27,15 +27,15 @@ typedef struct B {
enum F_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Foo,
Bar,
Baz,
};
#ifndef __cplusplus
typedef uint8_t F_Tag;
#endif // __cplusplus
#endif // __cplusplus

typedef struct Bar_Body {
F_Tag tag;
Expand All @@ -55,15 +55,15 @@ typedef union F {
enum H_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Hello,
There,
Everyone,
};
#ifndef __cplusplus
typedef uint8_t H_Tag;
#endif // __cplusplus
#endif // __cplusplus

typedef struct There_Body {
uint8_t x;
Expand All @@ -82,10 +82,10 @@ typedef struct H {

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(struct A x, struct B y, C z, union F f, struct H h);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus
16 changes: 8 additions & 8 deletions tests/expectations/annotation_tag.compat.c
Expand Up @@ -6,14 +6,14 @@
enum C
#ifdef __cplusplus
: uint32_t
#endif // __cplusplus
#endif // __cplusplus
{
X = 2,
Y,
};
#ifndef __cplusplus
typedef uint32_t C;
#endif // __cplusplus
#endif // __cplusplus

struct A {
int32_t m0;
Expand All @@ -27,15 +27,15 @@ struct B {
enum F_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Foo,
Bar,
Baz,
};
#ifndef __cplusplus
typedef uint8_t F_Tag;
#endif // __cplusplus
#endif // __cplusplus

struct Bar_Body {
F_Tag tag;
Expand All @@ -55,15 +55,15 @@ union F {
enum H_Tag
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
#endif // __cplusplus
{
Hello,
There,
Everyone,
};
#ifndef __cplusplus
typedef uint8_t H_Tag;
#endif // __cplusplus
#endif // __cplusplus

struct There_Body {
uint8_t x;
Expand All @@ -82,10 +82,10 @@ struct H {

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#endif // __cplusplus

void root(struct A x, struct B y, C z, union F f, struct H h);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __cplusplus