summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-10-15 03:22:10 +0000
committerjbj <devnull@localhost>2001-10-15 03:22:10 +0000
commitd8dc44f36377c59164d19106f0f93843ea5b3a09 (patch)
tree8f521d9b295dd0e9d05721cfd97f3d8a5b30801d /build
parent4b67d7621c20e1f2c5aa1ebdf7bb26eb3a6ae0d5 (diff)
downloadrpm-d8dc44f36377c59164d19106f0f93843ea5b3a09.tar.gz
rpm-d8dc44f36377c59164d19106f0f93843ea5b3a09.tar.bz2
rpm-d8dc44f36377c59164d19106f0f93843ea5b3a09.zip
lclint fiddles to annotate globals.
CVS patchset: 5106 CVS date: 2001/10/15 03:22:10
Diffstat (limited to 'build')
-rw-r--r--build/build.c10
-rw-r--r--build/buildio.h10
-rw-r--r--build/expression.c11
-rw-r--r--build/files.c47
-rw-r--r--build/myftw.c3
-rw-r--r--build/names.c8
-rw-r--r--build/pack.c18
-rw-r--r--build/parseDescription.c4
-rw-r--r--build/parseFiles.c3
-rw-r--r--build/parsePreamble.c22
-rw-r--r--build/parsePrep.c19
-rw-r--r--build/parseReqs.c1
-rw-r--r--build/parseScript.c4
-rw-r--r--build/parseSpec.c7
-rw-r--r--build/rpmbuild.h84
-rw-r--r--build/rpmspec.h11
-rw-r--r--build/spec.c5
17 files changed, 213 insertions, 54 deletions
diff --git a/build/build.c b/build/build.c
index fdbf6ee8a..60fc36677 100644
--- a/build/build.c
+++ b/build/build.c
@@ -10,6 +10,7 @@
#include "debug.h"
+/*@unchecked@*/
static int _build_debug = 0;
/*@access StringBuf @*/
@@ -19,19 +20,22 @@ static int _build_debug = 0;
/**
*/
static void doRmSource(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fileSystem @*/
{
struct Source *p;
Package pkg;
+ int rc;
#if 0
- Unlink(spec->specFile);
+ rc = Unlink(spec->specFile);
#endif
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
- (void) Unlink(fn);
+ rc = Unlink(fn);
fn = _free(fn);
}
}
@@ -40,7 +44,7 @@ static void doRmSource(Spec spec)
for (p = pkg->icon; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
- (void) Unlink(fn);
+ rc = Unlink(fn);
fn = _free(fn);
}
}
diff --git a/build/buildio.h b/build/buildio.h
index 36f225feb..a84da6c7d 100644
--- a/build/buildio.h
+++ b/build/buildio.h
@@ -38,7 +38,10 @@ extern "C" {
/*@out@*/ struct rpmlead * lead,
/*@out@*/ Header * sigs,
CSA_t csa)
- /*@modifies *specp, *lead, *sigs, csa, csa->cpioFdIn @*/;
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies *specp, *lead, *sigs, csa, csa->cpioFdIn,
+ fileSystem, internalState @*/;
/**
* Write rpm package to file.
@@ -60,7 +63,10 @@ int writeRPM(Header * hdrp,
CSA_t csa,
/*@null@*/ char * passPhrase,
/*@out@*/ const char ** cookie)
- /*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize @*/;
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize,
+ fileSystem, internalState @*/;
#ifdef __cplusplus
}
diff --git a/build/expression.c b/build/expression.c
index 3b8ee4c3c..eb7e3da68 100644
--- a/build/expression.c
+++ b/build/expression.c
@@ -182,6 +182,7 @@ static const char *prToken(int val)
* @param state expression parser state
*/
static int rdToken(ParseState state)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
{
int token;
@@ -317,12 +318,14 @@ static int rdToken(ParseState state)
}
static Value doLogical(ParseState state)
- /*@*/;
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies state->nextToken @*/;
/**
* @param state expression parser state
*/
static Value doPrimary(ParseState state)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
{
Value v;
@@ -400,6 +403,7 @@ static Value doPrimary(ParseState state)
* @param state expression parser state
*/
static Value doMultiplyDivide(ParseState state)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
{
Value v1, v2 = NULL;
@@ -450,6 +454,7 @@ static Value doMultiplyDivide(ParseState state)
* @param state expression parser state
*/
static Value doAddSubtract(ParseState state)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
{
Value v1, v2 = NULL;
@@ -509,6 +514,7 @@ static Value doAddSubtract(ParseState state)
* @param state expression parser state
*/
static Value doRelational(ParseState state)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
{
Value v1, v2 = NULL;
@@ -601,7 +607,8 @@ static Value doRelational(ParseState state)
* @param state expression parser state
*/
static Value doLogical(ParseState state)
- /*@modifies state->nextToken @*/
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies state->nextToken, rpmGlobalMacroContext @*/
{
Value v1, v2 = NULL;
diff --git a/build/files.c b/build/files.c
index 1b1b363b8..d1c632a7e 100644
--- a/build/files.c
+++ b/build/files.c
@@ -32,6 +32,7 @@
#define MAXDOCDIR 1024
/*@-redecl@*/
+/*@unchecked@*/
extern int _noDirTokens;
/*@=redecl@*/
@@ -88,6 +89,7 @@ typedef struct AttrRec_s {
/**
*/
+/*@unchecked@*/
static int multiLib = 0; /* MULTILIB */
/**
@@ -177,6 +179,7 @@ static void dupAttrRec(const AttrRec oar, /*@in@*/ /*@out@*/ AttrRec nar)
/**
*/
static void dumpAttrRec(const char * msg, AttrRec ar)
+ /*@globals fileSystem@*/
/*@modifies fileSystem @*/
{
if (msg)
@@ -281,6 +284,7 @@ typedef struct VFA {
/**
*/
/*@-exportlocal -exportheadervar@*/
+/*@unchecked@*/
VFA_t verifyAttrs[] = {
{ "md5", RPMVERIFY_MD5 },
{ "size", RPMVERIFY_FILESIZE },
@@ -775,6 +779,7 @@ static int parseForLang(char * buf, FileList fl)
/**
*/
static int parseForRegexLang(const char * fileName, /*@out@*/ char ** lang)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies *lang @*/
{
static int initialized = 0;
@@ -817,7 +822,9 @@ static int parseForRegexLang(const char * fileName, /*@out@*/ char ** lang)
/**
*/
-static int parseForRegexMultiLib(const char *fileName) /*@*/
+static int parseForRegexMultiLib(const char *fileName)
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/
{
static int initialized = 0;
static int hasRegex = 0;
@@ -848,6 +855,7 @@ static int parseForRegexMultiLib(const char *fileName) /*@*/
/**
*/
/*@-exportlocal -exportheadervar@*/
+/*@unchecked@*/
VFA_t virtualFileAttributes[] = {
{ "%dir", 0 }, /* XXX why not RPMFILE_DIR? */
{ "%doc", RPMFILE_DOC },
@@ -874,6 +882,7 @@ VFA_t virtualFileAttributes[] = {
*/
static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char * buf,
FileList fl, /*@out@*/ const char ** fileName)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies buf, fl->processingFailed, *fileName,
fl->currentFlags,
fl->docDirs, fl->docDirCount, fl->isDir,
@@ -1097,7 +1106,10 @@ static void checkHardLinks(FileList fl)
*/
static void genCpioListAndHeader(/*@partial@*/ FileList fl,
TFI_t * cpioList, Header h, int isSrc)
- /*@modifies h, *cpioList, fl->processingFailed, fl->fileList @*/
+ /*@globals rpmGlobalMacroContext,
+ fileSystem @*/
+ /*@modifies h, *cpioList, fl->processingFailed, fl->fileList,
+ fileSystem @*/
{
int _addDotSlash = !(isSrc || rpmExpandNumeric("%{_noPayloadPrefix}"));
uint_32 multiLibMask = 0;
@@ -1414,9 +1426,12 @@ static /*@null@*/ FileListRec freeFileList(/*@only@*/ FileListRec fileList,
* @param fl package file tree walk data
*/
static int addFile(FileList fl, const char * diskURL, struct stat * statp)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies *statp, fl->processingFailed,
fl->fileList, fl->fileListRecsAlloced, fl->fileListRecsUsed,
- fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir @*/
+ fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir,
+ rpmGlobalMacroContext, fileSystem @*/
{
const char *fileURL = diskURL;
struct stat statbuf;
@@ -1625,9 +1640,12 @@ static int addFile(FileList fl, const char * diskURL, struct stat * statp)
*/
static int processBinaryFile(/*@unused@*/ Package pkg, FileList fl,
const char * fileURL)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fl->processingFailed,
fl->fileList, fl->fileListRecsAlloced, fl->fileListRecsUsed,
- fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir @*/
+ fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir,
+ fileSystem @*/
{
int doGlob;
const char *diskURL = NULL;
@@ -1695,8 +1713,11 @@ exit:
*/
static int processPackageFiles(Spec spec, Package pkg,
int installSpecialDoc, int test)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState@*/
/*@modifies spec->macros,
- pkg->cpioList, pkg->fileList, pkg->specialDoc, pkg->header */
+ pkg->cpioList, pkg->fileList, pkg->specialDoc, pkg->header,
+ fileSystem, internalState @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
struct FileList_s fl;
@@ -2150,7 +2171,8 @@ int processSourceFiles(Spec spec)
static StringBuf getOutputFrom(char * dir, char * argv[],
const char * writePtr, int writeBytesLeft,
int failNonZero)
- /*@*/
+ /*@globals fileSystem, internalState@*/
+ /*@modifies fileSystem, internalState@*/
{
int progPID;
int toProg[2];
@@ -2295,6 +2317,7 @@ typedef struct {
/**
*/
/*@-exportlocal -exportheadervar@*/
+/*@unchecked@*/
DepMsg_t depMsgs[] = {
{ "Provides", { "%{__find_provides}", NULL, NULL, NULL },
RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
@@ -2339,7 +2362,9 @@ DepMsg_t depMsgs[] = {
/**
*/
static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
- /*@modifies cpioList @*/
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies cpioList, fileSystem, internalState @*/
{
TFI_t fi = cpioList;
StringBuf writeBuf;
@@ -2459,7 +2484,7 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
*/
static void printDepMsg(DepMsg_t * dm, int count, const char ** names,
const char ** versions, int *flags)
- /*@modifies fileSystem @*/
+ /*@*/
{
int hasVersions = (versions != NULL);
int hasFlags = (flags != NULL);
@@ -2500,7 +2525,7 @@ static void printDepMsg(DepMsg_t * dm, int count, const char ** names,
/**
*/
static void printDeps(Header h)
- /*@modifies fileSystem @*/
+ /*@*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@@ -2546,7 +2571,9 @@ static void printDeps(Header h)
(void) hge(h, dm->ftag, NULL, (void **) &flags, NULL);
/*@switchbreak@*/ break;
}
+ /*@-noeffect@*/
printDepMsg(dm, count, names, versions, flags);
+ /*@=noeffect@*/
}
names = hfd(names, dnt);
versions = hfd(versions, dvt);
@@ -2579,7 +2606,9 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
(void) generateDepends(spec, pkg, pkg->cpioList, 2);
} else
(void) generateDepends(spec, pkg, pkg->cpioList, 0);
+ /*@-noeffect@*/
printDeps(pkg->header);
+ /*@=noeffect@*/
}
return res;
diff --git a/build/myftw.c b/build/myftw.c
index c91b8c648..20708ec97 100644
--- a/build/myftw.c
+++ b/build/myftw.c
@@ -57,7 +57,8 @@ myftw_dir (DIR **dirs, int level, int descriptors,
char *dir, size_t len,
myftwFunc func,
void *fl)
- /*@*/
+ /*@globals fileSystem@*/
+ /*@modifies fileSystem@*/
{
int got;
struct dirent *entry;
diff --git a/build/names.c b/build/names.c
index 321146e1b..bd4a14fae 100644
--- a/build/names.c
+++ b/build/names.c
@@ -11,12 +11,18 @@
typedef /*@owned@*/ /*@null@*/ const char * ugstr_t;
+/*@unchecked@*/
static uid_t uids[1024];
+/*@unchecked@*/
static ugstr_t unames[1024];
+/*@unchecked@*/
static int uid_used = 0;
+/*@unchecked@*/
static gid_t gids[1024];
+/*@unchecked@*/
static ugstr_t gnames[1024];
+/*@unchecked@*/
static int gid_used = 0;
void freeNames(void)
@@ -178,7 +184,9 @@ const char *const buildHost(void)
if (! gotit) {
(void) gethostname(hostname, sizeof(hostname));
/*@-unrecog -multithreaded @*/
+ /*@-globs@*/ /* FIX: h_errno access */
hbn = gethostbyname(hostname);
+ /*@=globs@*/
/*@=unrecog =multithreaded @*/
if (hbn)
strcpy(hostname, hbn->h_name);
diff --git a/build/pack.c b/build/pack.c
index ad1c93611..962b48085 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -15,6 +15,7 @@
#include "debug.h"
/*@-redecl@*/
+/*@unchecked@*/
extern int _noDirTokens;
/*@=redecl@*/
@@ -47,6 +48,8 @@ static inline int genSourceRpmName(Spec spec)
*/
static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
const char * fmodeMacro)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fdo, csa, fileSystem @*/
{
const char * rootDir = "/";
@@ -94,6 +97,7 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
/**
*/
static int cpio_copy(FD_t fdo, CSA_t csa)
+ /*@globals fileSystem@*/
/*@modifies fdo, csa, fileSystem @*/
{
char buf[BUFSIZ];
@@ -119,6 +123,8 @@ static int cpio_copy(FD_t fdo, CSA_t csa)
*/
static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
const char * file, /*@only@*/ StringBuf sb)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fileSystem @*/
{
char buf[BUFSIZ];
@@ -153,6 +159,8 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
/**
*/
static int addFileToTag(Spec spec, const char * file, Header h, int tag)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies h, fileSystem @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@@ -176,6 +184,8 @@ static int addFileToTag(Spec spec, const char * file, Header h, int tag)
/**
*/
static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies h, fileSystem @*/
{
StringBuf sb = newStringBuf();
@@ -194,6 +204,8 @@ static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
/**
*/
static int processScriptFiles(Spec spec, Package pkg)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies pkg->header, fileSystem @*/
{
struct TriggerFileEntry *p;
@@ -334,16 +346,19 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead,
return 0;
}
+/*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
#define RPMPKGVERSION_MIN 30004
#define RPMPKGVERSION_MAX 40003
+/*@unchecked@*/
static int rpmpkg_version = -1;
static int rpmLeadVersion(void)
- /*@*/
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/
{
int rpmlead_version;
@@ -656,6 +671,7 @@ exit:
return rc;
}
+/*@unchecked@*/
static int_32 copyTags[] = {
RPMTAG_CHANGELOGTIME,
RPMTAG_CHANGELOGNAME,
diff --git a/build/parseDescription.c b/build/parseDescription.c
index 2eecc6fb3..b27312695 100644
--- a/build/parseDescription.c
+++ b/build/parseDescription.c
@@ -9,13 +9,17 @@
#include "debug.h"
/*@-exportheadervar@*/
+/*@unchecked@*/
extern int noLang;
/*@=exportheadervar@*/
/* These have to be global scope to make up for *stupid* compilers */
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *name = NULL;
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *lang = NULL;
+/*@unchecked@*/
static struct poptOption optionsTable[] = {
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
{ NULL, 'l', POPT_ARG_STRING, &lang, 'l', NULL, NULL},
diff --git a/build/parseFiles.c b/build/parseFiles.c
index 10e6cb056..f6ee8c90c 100644
--- a/build/parseFiles.c
+++ b/build/parseFiles.c
@@ -12,8 +12,11 @@
/*@access poptContext @*/ /* compared with NULL */
/* These have to be global scope to make up for *stupid* compilers */
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *name = NULL;
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *file = NULL;
+/*@unchecked@*/
static struct poptOption optionsTable[] = {
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
{ NULL, 'f', POPT_ARG_STRING, &file, 'f', NULL, NULL},
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index d5b182189..3e07ecbf1 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -13,7 +13,8 @@
/**
*/
-/*@observer@*/ static rpmTag copyTagsDuringParse[] = {
+/*@observer@*/ /*@unchecked@*/
+static rpmTag copyTagsDuringParse[] = {
RPMTAG_EPOCH,
RPMTAG_VERSION,
RPMTAG_RELEASE,
@@ -33,7 +34,8 @@
/**
*/
-/*@observer@*/ static rpmTag requiredTags[] = {
+/*@observer@*/ /*@unchecked@*/
+static rpmTag requiredTags[] = {
RPMTAG_NAME,
RPMTAG_VERSION,
RPMTAG_RELEASE,
@@ -63,7 +65,8 @@ static void addOrAppendListEntry(Header h, int_32 tag, char * line)
/**
*/
static int parseSimplePart(char *line, /*@out@*/char **name, /*@out@*/int *flag)
- /*@modifies *name, *flag @*/
+ /*@globals internalState@*/
+ /*@modifies *name, *flag, internalState @*/
{
char *tok;
char linebuf[BUFSIZ];
@@ -109,6 +112,7 @@ typedef struct tokenBits_s {
/**
*/
+/*@observer@*/ /*@unchecked@*/
static struct tokenBits_s installScriptBits[] = {
{ "interp", RPMSENSE_INTERP },
{ "prereq", RPMSENSE_PREREQ },
@@ -123,6 +127,7 @@ static struct tokenBits_s installScriptBits[] = {
/**
*/
+/*@observer@*/ /*@unchecked@*/
static struct tokenBits_s buildScriptBits[] = {
{ "prep", RPMSENSE_SCRIPT_PREP },
{ "build", RPMSENSE_SCRIPT_BUILD },
@@ -300,6 +305,7 @@ static int checkForDuplicates(Header h, const char * NVR)
/**
*/
+/*@observer@*/ /*@unchecked@*/
static struct optionalTag {
rpmTag ot_tag;
/*@observer@*/ /*@null@*/ const char * ot_mac;
@@ -314,6 +320,7 @@ static struct optionalTag {
/**
*/
static void fillOutMainPackage(Header h)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies h @*/
{
struct optionalTag *ot;
@@ -331,6 +338,8 @@ static void fillOutMainPackage(Header h)
/**
*/
static int readIcon(Header h, const char * file)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies h, fileSystem @*/
{
const char *fn = NULL;
@@ -433,11 +442,14 @@ extern int noLang;
*/
static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
const char *lang)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem @*/
/*@modifies spec->macros, spec->st, spec->buildRootURL,
spec->sources, spec->numSources, spec->noSource,
spec->buildRestrictions, spec->BANames, spec->BACount,
spec->line, spec->gotBuildRootURL,
- pkg->header, pkg->autoProv, pkg->autoReq, pkg->icon @*/
+ pkg->header, pkg->autoProv, pkg->autoReq, pkg->icon,
+ fileSystem @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@@ -694,6 +706,8 @@ typedef struct PreambleRec_s {
int multiLang;
/*@observer@*/ /*@null@*/ const char * token;
} * PreambleRec;
+
+/*@unchecked@*/
static struct PreambleRec_s preambleList[] = {
{RPMTAG_NAME, 0, 0, "name"},
{RPMTAG_VERSION, 0, 0, "version"},
diff --git a/build/parsePrep.c b/build/parsePrep.c
index d12c47c3f..5879383be 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -12,9 +12,13 @@
/*@access StringBuf @*/ /* compared with NULL */
/* These have to be global to make up for stupid compilers */
+/*@unchecked@*/
static int leaveDirs, skipDefaultAction;
+/*@unchecked@*/
static int createDir, quietly;
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char * dirName = NULL;
+/*@unchecked@*/
/*@observer@*/ static struct poptOption optionsTable[] = {
{ NULL, 'a', POPT_ARG_STRING, NULL, 'a', NULL, NULL},
{ NULL, 'b', POPT_ARG_STRING, NULL, 'b', NULL, NULL},
@@ -32,7 +36,8 @@
* @return 0 on success
*/
static int checkOwners(const char * urlfn)
- /*@*/
+ /*@globals fileSystem @*/
+ /*@modifies fileSystem @*/
{
struct stat sb;
@@ -61,6 +66,8 @@ static int checkOwners(const char * urlfn)
*/
/*@observer@*/ static char *doPatch(Spec spec, int c, int strip, const char *db,
int reverse, int removeEmpties)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fileSystem @*/
{
const char *fn, *urlfn;
@@ -152,6 +159,8 @@ static int checkOwners(const char * urlfn)
* @return expanded %setup macro (NULL on error)
*/
/*@observer@*/ static const char *doUntar(Spec spec, int c, int quietly)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies fileSystem @*/
{
const char *fn, *urlfn;
@@ -174,7 +183,9 @@ static int checkOwners(const char * urlfn)
urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+ /*@-internalglobs@*/ /* FIX: shrug */
taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
+ /*@=internalglobs@*/
#ifdef AUTOFETCH_NOT /* XXX don't expect this code to be enabled */
/* XXX
@@ -266,6 +277,8 @@ static int checkOwners(const char * urlfn)
* @return 0 on success
*/
static int doSetupMacro(Spec spec, char *line)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->buildSubdir, spec->macros, spec->prep,
fileSystem @*/
{
@@ -418,6 +431,8 @@ static int doSetupMacro(Spec spec, char *line)
* @return 0 on success
*/
static int doPatchMacro(Spec spec, char *line)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->prep, fileSystem @*/
{
char *opt_b;
@@ -439,6 +454,7 @@ static int doPatchMacro(Spec spec, char *line)
strcpy(buf, line);
}
+ /*@-internalglobs@*/ /* FIX: strtok has state */
for (bp = buf; (s = strtok(bp, " \t\n")) != NULL;) {
if (bp) { /* remove 1st token (%patch) */
bp = NULL;
@@ -501,6 +517,7 @@ static int doPatchMacro(Spec spec, char *line)
patch_index++;
}
}
+ /*@=internalglobs@*/
/* All args processed */
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 848bc008f..346373fce 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -10,6 +10,7 @@
/**
*/
+/*@observer@*/ /*@unchecked@*/
static struct ReqComp {
/*@observer@*/ /*@null@*/ const char * token;
rpmsenseFlags sense;
diff --git a/build/parseScript.c b/build/parseScript.c
index 58b0d3284..bc9030d7e 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -47,9 +47,13 @@ static int addTriggerIndex(Package pkg, const char *file,
}
/* these have to be global because of stupid compilers */
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *name = NULL;
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *prog = NULL;
+/*@unchecked@*/
/*@observer@*/ /*@null@*/ static const char *file = NULL;
+/*@unchecked@*/
static struct poptOption optionsTable[] = {
{ NULL, 'p', POPT_ARG_STRING, &prog, 'p', NULL, NULL},
{ NULL, 'n', POPT_ARG_STRING, &name, 'n', NULL, NULL},
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 7ead34a68..04cb275cf 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -5,6 +5,7 @@
#include "system.h"
+/*@unchecked@*/
static int _debug = 0;
#include <rpmio_internal.h>
@@ -15,6 +16,7 @@ static int _debug = 0;
/**
*/
+/*@unchecked@*/
static struct PartRec {
int part;
int len;
@@ -115,7 +117,9 @@ static void forceIncludeFile(Spec spec, const char * fileName)
/**
*/
static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
- /*@modifies spec->nextline @*/
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
+ /*@modifies spec->nextline, fileSystem @*/
{
char *last;
char ch;
@@ -357,6 +361,7 @@ void closeSpec(Spec spec)
}
/*@-redecl@*/
+/*@unchecked@*/
extern int noLang; /* XXX FIXME: pass as arg */
/*@=redecl@*/
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index ca48b5fb4..de2856bc9 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -83,6 +83,7 @@ extern "C" {
* Destroy uid/gid caches.
*/
void freeNames(void)
+ /*@globals internalState@*/
/*@modifies internalState */;
/** \ingroup rpmbuild
@@ -152,6 +153,8 @@ extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/;
* @return 0 on success, 1 on EOF, <0 on error
*/
int readLine(Spec spec, int strip)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
@@ -160,7 +163,8 @@ int readLine(Spec spec, int strip)
* @param spec spec file control structure
*/
void closeSpec(/*@partial@*/ Spec spec)
- /*@modifies spec->fileStack @*/;
+ /*@globals fileSystem@*/
+ /*@modifies spec->fileStack, fileSystem @*/;
/** \ingroup rpmbuild
* Truncate comment lines.
@@ -203,9 +207,11 @@ void addChangelogEntry(Header h, time_t time, const char * name,
* @return >= 0 next rpmParseState, < 0 on error
*/
int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem @*/
/*@modifies spec->build, spec->install, spec->clean, spec->macros,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
- spec->sl @*/;
+ spec->sl, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%changelog section of a spec file.
@@ -213,9 +219,11 @@ int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
* @return >= 0 next rpmParseState, < 0 on error
*/
int parseChangelog(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl,
- spec->packages->header @*/;
+ spec->packages->header, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%description section of a spec file.
@@ -223,9 +231,11 @@ int parseChangelog(Spec spec)
* @return >= 0 next rpmParseState, < 0 on error
*/
int parseDescription(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
- spec->sl, spec->st @*/;
+ spec->sl, spec->st, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%files section of a spec file.
@@ -233,9 +243,11 @@ int parseDescription(Spec spec)
* @return >= 0 next rpmParseState, < 0 on error
*/
int parseFiles(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
- spec->sl @*/;
+ spec->sl, fileSystem @*/;
/** \ingroup rpmbuild
* Parse tags from preamble of a spec file.
@@ -244,13 +256,15 @@ int parseFiles(Spec spec)
* @return >= 0 next rpmParseState, < 0 on error
*/
int parsePreamble(Spec spec, int initialPackage)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->buildSubdir, spec->sl,
spec->macros, spec->st, spec->buildRootURL,
spec->sources, spec->numSources, spec->noSource,
spec->buildRestrictions, spec->BANames, spec->BACount,
- spec->gotBuildRootURL @*/;
+ spec->gotBuildRootURL, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Parse %%prep section of a spec file.
@@ -258,9 +272,11 @@ int parsePreamble(Spec spec, int initialPackage)
* @return >= 0 next rpmParseState, < 0 on error
*/
int parsePrep(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->prep, spec->buildSubdir, spec->macros,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
- spec->sl @*/;
+ spec->sl, fileSystem @*/;
/** \ingroup rpmbuild
* Parse dependency relations from spec file and/or autogenerated output buffer.
@@ -274,7 +290,8 @@ int parsePrep(Spec spec)
*/
int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
rpmsenseFlags flags)
- /*@modifies nothing @*/;
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/;
/** \ingroup rpmbuild
* Parse %%pre et al scriptlets from a spec file.
@@ -283,9 +300,11 @@ int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
* @return >= 0 next rpmParseState, < 0 on error
*/
int parseScript(Spec spec, int parsePart)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
- spec->sl @*/;
+ spec->sl, fileSystem @*/;
/** \ingroup rpmbuild
* Evaluate boolean expression.
@@ -293,7 +312,9 @@ int parseScript(Spec spec, int parsePart)
* @param expr expression to parse
* @return
*/
-int parseExpressionBoolean(Spec spec, const char * expr) /*@*/;
+int parseExpressionBoolean(Spec spec, const char * expr)
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/;
/** \ingroup rpmbuild
* Evaluate string expression.
@@ -303,7 +324,8 @@ int parseExpressionBoolean(Spec spec, const char * expr) /*@*/;
*/
/*@unused@*/
char * parseExpressionString(Spec spec, const char * expr)
- /*@modifies nothing @*/;
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/;
/** \ingroup rpmbuild
* Run a build script, assembled from spec file scriptlet section.
@@ -316,7 +338,10 @@ char * parseExpressionString(Spec spec, const char * expr)
* @return 0 on success, RPMERR_SCRIPT on failure
*/
int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
- /*@modifies spec->macros, fileSystem @*/;
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies spec->macros,
+ rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Find sub-package control structure by name.
@@ -327,8 +352,8 @@ int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
* @return 0 on success, 1 on failure
*/
int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
- /*@out@*/ Package * pkg)
- /*@modifies spec->packages, *pkg @*/;
+ /*@out@*/ Package * pkg)
+ /*@modifies spec->packages, *pkg @*/;
/** \ingroup rpmbuild
* Create and initialize package control structure.
@@ -387,10 +412,12 @@ int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
* @return 0 on success
*/
int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies spec->macros,
spec->packages->cpioList, spec->packages->fileList,
spec->packages->specialDoc, spec->packages->header,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Create and initialize header for source package.
@@ -407,11 +434,12 @@ void initSourceHeader(Spec spec)
* @return 0 on success
*/
int processSourceFiles(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem @*/
/*@modifies spec->sourceHeader, spec->sourceCpioList,
spec->buildRestrictions, spec->BANames,
- spec->packages->header @*/;
-
-/* global entry points */
+ spec->packages->header,
+ fileSystem @*/;
/** \ingroup rpmbuild
* Parse spec file into spec control structure.
@@ -433,8 +461,10 @@ int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
/*@null@*/ const char * passPhrase,
/*@null@*/ char * cookie,
int anyarch, int force)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies *specp,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/** \ingroup rpmbuild
* @retval specp spec file control structure
@@ -456,8 +486,10 @@ extern int (*parseSpecVec) (Spec * specp, const char * specFile,
/*@null@*/ const char * passPhrase,
/*@null@*/ char * cookie,
int anyarch, int force)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies *specp,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/*@=declundef@*/
/** \ingroup rpmbuild
@@ -468,13 +500,15 @@ extern int (*parseSpecVec) (Spec * specp, const char * specFile,
* @return 0 on success
*/
int buildSpec(Spec spec, int what, int test)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
spec->sourceRpmName, spec->macros,
spec->BASpecs,
spec->buildRestrictions, spec->BANames,
spec->packages->cpioList, spec->packages->fileList,
spec->packages->specialDoc, spec->packages->header,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Generate binary package(s).
@@ -482,9 +516,11 @@ int buildSpec(Spec spec, int what, int test)
* @return 0 on success
*/
int packageBinaries(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies spec->packages->header,
spec->sourceRpmName,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Generate source package.
@@ -492,9 +528,11 @@ int packageBinaries(Spec spec)
* @return 0 on success
*/
int packageSources(Spec spec)
+ /*@globals rpmGlobalMacroContext,
+ fileSystem, internalState @*/
/*@modifies spec->sourceHeader, spec->cookie,
spec->sourceRpmName,
- fileSystem @*/;
+ fileSystem, internalState @*/;
/*@=redecl@*/
#ifdef __cplusplus
diff --git a/build/rpmspec.h b/build/rpmspec.h
index d0c44d011..b57713aee 100644
--- a/build/rpmspec.h
+++ b/build/rpmspec.h
@@ -180,7 +180,9 @@ extern "C" {
* Create and initialize Spec structure.
* @return spec spec file control structure
*/
-/*@only@*/ Spec newSpec(void) /*@*/;
+/*@only@*/ Spec newSpec(void)
+ /*@globals rpmGlobalMacroContext @*/
+ /*@modifies rpmGlobalMacroContext @*/;
/** \ingroup rpmbuild
* Destroy Spec structure.
@@ -188,7 +190,8 @@ extern "C" {
* @return NULL always
*/
/*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec)
- /*@modifies spec @*/;
+ /*@globals fileSystem @*/
+ /*@modifies spec, fileSystem @*/;
/** \ingroup rpmbuild
* @param spec spec file control structure
@@ -196,7 +199,8 @@ extern "C" {
*/
/*@-declundef@*/
extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */
- /*@modifies spec @*/;
+ /*@globals fileSystem @*/
+ /*@modifies spec, fileSystem @*/;
/*@=declundef@*/
/** \ingroup rpmbuild
@@ -213,6 +217,7 @@ spectag stashSt(Spec spec, Header h, int tag, const char * lang)
* @param spec spec file control structure
*/
int addSource(Spec spec, Package pkg, const char * field, int tag)
+ /*@globals rpmGlobalMacroContext @*/
/*@modifies spec->sources, spec->numSources,
spec->st, spec->macros,
pkg->icon @*/;
diff --git a/build/spec.c b/build/spec.c
index 785304b77..92f115927 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -11,9 +11,6 @@
/*@-redecl@*/
extern int specedit;
/*@=redecl@*/
-/*@-exportheadervar@*/
-extern struct MacroContext_s rpmGlobalMacroContext;
-/*@=exportheadervar@*/
#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
@@ -451,7 +448,7 @@ Spec newSpec(void)
spec->force = 0;
spec->anyarch = 0;
- spec->macros = &rpmGlobalMacroContext;
+ spec->macros = rpmGlobalMacroContext;
return spec;
}