Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix not working --no-missing-ricardian-clause #1197

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions tests/toolchain/compile-pass/no-missing-ricardian-clause.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <eosio/eosio.hpp>

using namespace eosio;

class [[eosio::contract]] no_missing_ricardian_clause : public contract {
public:
using contract::contract;

[[eosio::action]]
void test1( name user ) {
}
};
11 changes: 11 additions & 0 deletions tests/toolchain/compile-pass/no-missing-ricardian-clause.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tests" : [
{
"compile_flags": ["--no-missing-ricardian-clause"],
"expected" : {
"exit-code": 0,
"stdout": ""
}
}
]
}
16 changes: 4 additions & 12 deletions tools/include/eosio/abigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,8 @@ namespace eosio { namespace cdt {
auto action_name = decl->getEosioActionAttr()->getName();

if (!checked_actions.insert(get_action_name(decl)).second)
CDT_CHECK_WARN(!rcs[get_action_name(decl)].empty(), "abigen_warning", decl->getLocation(), "Action <"+get_action_name(decl)+"> does not have a ricardian contract");

if (!suppress_ricardian_warnings)
if (rcs[get_action_name(decl)].empty())
// TODO:
std::cout << "Warning, action <"+get_action_name(decl)+"> does not have a ricardian contract\n";
if (!suppress_ricardian_warnings)
CDT_CHECK_WARN(!rcs[get_action_name(decl)].empty(), "abigen_warning", decl->getLocation(), "Action <"+get_action_name(decl)+"> does not have a ricardian contract");

ret.ricardian_contract = rcs[get_action_name(decl)];

Expand All @@ -96,12 +92,8 @@ namespace eosio { namespace cdt {
auto action_name = decl->getEosioActionAttr()->getName();

if (!checked_actions.insert(get_action_name(decl)).second)
CDT_CHECK_WARN(!rcs[get_action_name(decl)].empty(), "abigen_warning", decl->getLocation(), "Action <"+get_action_name(decl)+"> does not have a ricardian contract");

if (!suppress_ricardian_warnings)
if (rcs[get_action_name(decl)].empty())
// TODO
std::cout << "Warning, action <"+get_action_name(decl)+"> does not have a ricardian contract\n";
if (!suppress_ricardian_warnings)
CDT_CHECK_WARN(!rcs[get_action_name(decl)].empty(), "abigen_warning", decl->getLocation(), "Action <"+get_action_name(decl)+"> does not have a ricardian contract");
Copy link

@dimas1185 dimas1185 Sep 2, 2021

Choose a reason for hiding this comment

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

what is the difference? Does it now outputs to stderr instead of stdout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duplicated code. It seems original author intended replacing stdout warning message with CDT_CHECK_WARN macro when macro is implemented, but just added rather than replace it.


ret.ricardian_contract = rcs[get_action_name(decl)];

Expand Down