<commit_before>// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package main

import (
	"bytes"
	"fmt"
	"os"
	"regexp"
	"strconv"
	"strings"
	"text/template"

	"github.com/google/syzkaller/pkg/compiler"
	"github.com/google/syzkaller/pkg/osutil"
)

func extract(info *compiler.ConstInfo, cc string, args []string, addSource string, declarePrintf bool, defineGlibcUse bool) (
	map[string]uint64, map[string]bool, error) {
	data := &CompileData{
		AddSource:      addSource,
		Defines:        info.Defines,
		Includes:       info.Includes,
		Values:         info.Consts,
		DeclarePrintf:  declarePrintf,
		DefineGlibcUse: defineGlibcUse,
	}
	undeclared := make(map[string]bool)
	bin, out, err := compile(cc, args, data)
	if err != nil {
		// Some consts and syscall numbers are not defined on some archs.
		// Figure out from compiler output undefined consts,
		// and try to compile again without them.<commit_msg>sys/syz-extract: fix too long line<commit_after>// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package main

import (
	"bytes"
	"fmt"
	"os"
	"regexp"
	"strconv"
	"strings"
	"text/template"

	"github.com/google/syzkaller/pkg/compiler"
	"github.com/google/syzkaller/pkg/osutil"
)

func extract(info *compiler.ConstInfo, cc string, args []string, addSource string, declarePrintf, defineGlibcUse bool) (
	map[string]uint64, map[string]bool, error) {
	data := &CompileData{
		AddSource:      addSource,
		Defines:        info.Defines,
		Includes:       info.Includes,
		Values:         info.Consts,
		DeclarePrintf:  declarePrintf,
		DefineGlibcUse: defineGlibcUse,
	}
	undeclared := make(map[string]bool)
	bin, out, err := compile(cc, args, data)
	if err != nil {
		// Some consts and syscall numbers are not defined on some archs.
		// Figure out from compiler output undefined consts,
		// and try to compile again without them.
{'fraction_non_alphanumeric': 0.10472972972972973, 'fraction_numerical': 0.006756756756756757, 'mean_word_length': 3.798611111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4705999', 'n_tokens_mistral': 719, 'n_tokens_neox': 680, 'n_words': 214}