Skip to content
Snippets Groups Projects
Commit 8cb4a2b4 authored by Yuriy Vostrikov's avatar Yuriy Vostrikov
Browse files

[core] remove cfg.h file hack, tweak scripts/indent

parent a50b926e
No related branches found
No related tags found
No related merge requests found
obj += cfg/warning.o
obj += cfg/tarantool_$(module)_cfg.o
$(obj): cfg/tarantool_cfg.h
.PHONY: cfg/tarantool_cfg.h
cfg/tarantool_cfg.h: cfg/tarantool_$(module)_cfg.h
@mkdir -p cfg
@ln -sf $(abspath $<) $@
ifeq ($(HAVE_CONFETTI),1)
$(obj): cfg/tarantool_$(module)_cfg.h cfg/tarantool_$(module)_cfg.cfg
cfg/tarantool_$(module)_cfg.h: cfg/tarantool_$(module)_cfg.cfg_tmpl
cfg/tarantool_$(module)_cfg.cfg_tmpl: cfg/core_cfg.cfg_tmpl $(cfg_tmpl)
@mkdir -p $(dir $@)
@echo '%{ ' > $@
......@@ -13,5 +19,4 @@ cfg/tarantool_$(module)_cfg.cfg_tmpl: cfg/core_cfg.cfg_tmpl $(cfg_tmpl)
$(CAT) $^ >> $@
endif
CFLAGS += -DTARANTOOL_CONFIG='<cfg/tarantool_$(module)_cfg.h>'
cfg/tarantool_$(module)_cfg.o: CFLAGS += -Wno-unused
......@@ -30,7 +30,7 @@
#include <tbuf.h>
#include <util.h>
#include <log_io.h>
#include TARANTOOL_CONFIG
#include <cfg/tarantool_cfg.h>
struct recovery_state *recovery_state;
void mod_init(void);
......
module Main where
import System
import qualified Data.Map as M
import Data.Maybe
import Language.C
import Language.C.System.GCC
import Language.C.Analysis.AstAnalysis
import Language.C.Analysis.SemRep
import Language.C.Analysis.TravMonad
main = do
args <- getArgs
parseFile (head args) (tail args) >>= printGlobalTypes
parseFile :: FilePath -> [String] -> IO CTranslUnit
parseFile input_file cOpts =
do parse_result <- parseCFile (newGCC "gcc") Nothing cOpts input_file
case parse_result of
Left parse_err -> error (show parse_err)
Right ast -> return ast
printGlobalTypes transUnit =
case runTrav_ (analyseAST transUnit) of
Left err -> error (show err)
Right (globals, _) -> mapM_ print $ globalTypeNames globals
globalTypeNames g =
map identToString $ typeNames ++ sueNames
where
typeNames = M.keys (gTypeDefs g)
sueNames = mapMaybe named (M.keys $ gTags g)
named (NamedRef x) = Just x
named _ = Nothing
......@@ -2,6 +2,8 @@
INDENT=$(which gindent 2>/dev/null || which indent 2>/dev/null)
[ -z $INDENT ] && echo indent binary not found && exit 1
CPP_FLAGS="-I. -Iinclude -DCORO_ASM -DSTORAGE"
for f in $@
do
PARAM="-npro -kr -i8 -ts8 -ci8 -sob -l100 -ss -ncs -cp1
......@@ -19,7 +21,7 @@ do
;;
esac
PARAM="$PARAM "$(gcc -E -I. -Iinclude -DSTORAGE -DTARANTOOL_CONFIG='<cfg/tarantool_silverbox_cfg.h>' $f | perl scripts/usertypes2indent.pl)
PARAM="$PARAM "$(scripts/custom_types $f $CPP_FLAGS | grep -v '^"_' | sed 's/"//g; s/^/-T /')
$INDENT $PARAM $f
done
#!/usr/bin/perl -w
use strict;
$/=undef;
$_ = <>;
my $brre;
$brre = qr/(?:[^{}]*|\{(??{$brre})\})*/;
my @a = /typedef\s+(?:(?:enum|struct|union)\s+[^{};]*\{$brre\}\s*|(?:\w+\s+)+)(\w+)[^;{}]*;/g;
foreach (@a) {
print "-T $_ ";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment