Fix clangformat and execute it

This commit is contained in:
Miodrag Milanovic 2020-06-27 13:20:16 +02:00
parent 901ad4e917
commit 7a95629aff
5 changed files with 23 additions and 27 deletions

View File

@ -334,8 +334,8 @@ foreach (family ${ARCH})
endforeach (family)
file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h)
string(REGEX REPLACE "[^;]*/ice40/chipdbs/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
string(REGEX REPLACE "[^;]*/ecp5/chipdbs/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
string(REGEX REPLACE "[^;]*/ice40/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
string(REGEX REPLACE "[^;]*/ecp5/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
string(REGEX REPLACE "[^;]*/3rdparty[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
string(REGEX REPLACE "[^;]*/generated[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")

View File

@ -1,16 +1,17 @@
#if defined(WIN32)
#include <windows.h>
#endif
#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/filesystem.hpp>
#include "nextpnr.h"
#include <boost/iostreams/device/mapped_file.hpp>
#include "embed.h"
#include "nextpnr.h"
NEXTPNR_NAMESPACE_BEGIN
#if defined(EXTERNAL_CHIPDB_ROOT)
const void *get_chipdb(const std::string &filename) {
const void *get_chipdb(const std::string &filename)
{
static std::map<std::string, boost::iostreams::mapped_file> files;
if (!files.count(filename)) {
std::string full_filename = EXTERNAL_CHIPDB_ROOT "/" + filename;
@ -24,7 +25,8 @@ const void *get_chipdb(const std::string &filename) {
#elif defined(WIN32)
const void *get_chipdb(const std::string &filename) {
const void *get_chipdb(const std::string &filename)
{
HRSRC rc = ::FindResource(nullptr, filename.c_str(), RT_RCDATA);
HGLOBAL rcData = ::LoadResource(nullptr, rc);
return ::LockResource(rcData);
@ -34,7 +36,8 @@ const void *get_chipdb(const std::string &filename) {
EmbeddedFile *EmbeddedFile::head = nullptr;
const void *get_chipdb(const std::string &filename) {
const void *get_chipdb(const std::string &filename)
{
for (EmbeddedFile *file = EmbeddedFile::head; file; file = file->next)
if (file->filename == filename)
return file->content;

View File

@ -33,8 +33,7 @@ struct EmbeddedFile
const void *content;
EmbeddedFile *next = nullptr;
EmbeddedFile(const std::string &filename, const void *content)
: filename(filename), content(content)
EmbeddedFile(const std::string &filename, const void *content) : filename(filename), content(content)
{
next = head;
head = this;

View File

@ -23,11 +23,11 @@
#include <boost/range/adaptor/reversed.hpp>
#include <cmath>
#include <cstring>
#include "embed.h"
#include "gfx.h"
#include "globals.h"
#include "log.h"
#include "nextpnr.h"
#include "embed.h"
#include "placer1.h"
#include "placer_heap.h"
#include "router1.h"
@ -61,16 +61,15 @@ void IdString::initialize_arch(const BaseCtx *ctx)
// -----------------------------------------------------------------------
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) {
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip)
{
std::string chipdb;
if (chip == ArchArgs::LFE5U_12F || chip == ArchArgs::LFE5U_25F ||
chip == ArchArgs::LFE5UM_25F || chip == ArchArgs::LFE5UM5G_25F) {
if (chip == ArchArgs::LFE5U_12F || chip == ArchArgs::LFE5U_25F || chip == ArchArgs::LFE5UM_25F ||
chip == ArchArgs::LFE5UM5G_25F) {
chipdb = "ecp5/chipdb-25k.bin";
} else if (chip == ArchArgs::LFE5U_45F ||
chip == ArchArgs::LFE5UM_45F || chip == ArchArgs::LFE5UM5G_45F) {
} else if (chip == ArchArgs::LFE5U_45F || chip == ArchArgs::LFE5UM_45F || chip == ArchArgs::LFE5UM5G_45F) {
chipdb = "ecp5/chipdb-45k.bin";
} else if (chip == ArchArgs::LFE5U_85F ||
chip == ArchArgs::LFE5UM_85F || chip == ArchArgs::LFE5UM5G_85F) {
} else if (chip == ArchArgs::LFE5U_85F || chip == ArchArgs::LFE5UM_85F || chip == ArchArgs::LFE5UM5G_85F) {
chipdb = "ecp5/chipdb-85k.bin";
} else {
log_error("Unknown chip\n");
@ -82,10 +81,7 @@ static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) {
return ptr->get();
}
bool Arch::isAvailable(ArchArgs::ArchArgsTypes chip)
{
return get_chip_info(chip) != nullptr;
}
bool Arch::isAvailable(ArchArgs::ArchArgsTypes chip) { return get_chip_info(chip) != nullptr; }
std::vector<std::string> Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip)
{

View File

@ -21,10 +21,10 @@
#include <algorithm>
#include <cmath>
#include "cells.h"
#include "embed.h"
#include "gfx.h"
#include "log.h"
#include "nextpnr.h"
#include "embed.h"
#include "placer1.h"
#include "placer_heap.h"
#include "router1.h"
@ -44,7 +44,8 @@ void IdString::initialize_arch(const BaseCtx *ctx)
// -----------------------------------------------------------------------
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) {
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip)
{
std::string chipdb;
if (chip == ArchArgs::LP384) {
chipdb = "ice40/chipdb-384.bin";
@ -66,10 +67,7 @@ static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) {
return ptr->get();
}
bool Arch::isAvailable(ArchArgs::ArchArgsTypes chip)
{
return get_chip_info(chip) != nullptr;
}
bool Arch::isAvailable(ArchArgs::ArchArgsTypes chip) { return get_chip_info(chip) != nullptr; }
std::vector<std::string> Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip)
{