From: Florian Krohm Date: Thu, 23 Oct 2014 17:47:15 +0000 (+0000) Subject: 2 pints later: more coregrind constification. X-Git-Tag: svn/VALGRIND_3_11_0~889 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa6abf5a1dd521543be9ef5e705fd590fe7495b3;p=thirdparty%2Fvalgrind.git 2 pints later: more coregrind constification. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14659 --- diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 2709fdbd72..f700c6c14c 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -262,7 +262,7 @@ void ML_(am_close) ( Int fd ) (void)VG_(do_syscall1)(__NR_close, fd); } -Int ML_(am_readlink)(HChar* path, HChar* buf, UInt bufsiz) +Int ML_(am_readlink)(const HChar* path, HChar* buf, UInt bufsiz) { SysRes res; # if defined(VGP_arm64_linux) @@ -430,12 +430,12 @@ VgStack* VG_(am_alloc_VgStack)( /*OUT*/Addr* initial_sp ) /* Figure out how many bytes of the stack's active area have not been used. Used for estimating if we are close to overflowing it. */ -SizeT VG_(am_get_VgStack_unused_szB)( VgStack* stack, SizeT limit ) +SizeT VG_(am_get_VgStack_unused_szB)( const VgStack* stack, SizeT limit ) { SizeT i; - UInt* p; + const UInt* p; - p = (UInt*)&stack->bytes[VG_STACK_GUARD_SZB]; + p = (const UInt*)&stack->bytes[VG_STACK_GUARD_SZB]; for (i = 0; i < VG_STACK_ACTIVE_SZB/sizeof(UInt); i++) { if (p[i] != 0xDEADBEEF) break; diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 88951c973b..36f6e37da0 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -501,7 +501,7 @@ static void show_len_concisely ( /*OUT*/HChar* buf, Addr start, Addr end ) /* Show full details of an NSegment */ static void __attribute__ ((unused)) - show_nsegment_full ( Int logLevel, Int segNo, NSegment* seg ) + show_nsegment_full ( Int logLevel, Int segNo, const NSegment* seg ) { HChar len_buf[20]; const HChar* name = "(none)"; @@ -531,7 +531,7 @@ static void __attribute__ ((unused)) /* Show an NSegment in a user-friendly-ish way. */ -static void show_nsegment ( Int logLevel, Int segNo, NSegment* seg ) +static void show_nsegment ( Int logLevel, Int segNo, const NSegment* seg ) { HChar len_buf[20]; show_len_concisely(len_buf, seg->start, seg->end); @@ -689,7 +689,7 @@ Int VG_(am_get_segment_starts)( Addr* starts, Int nStarts ) /* Check representational invariants for NSegments. */ -static Bool sane_NSegment ( NSegment* s ) +static Bool sane_NSegment ( const NSegment* s ) { if (s == NULL) return False; @@ -742,7 +742,7 @@ static Bool sane_NSegment ( NSegment* s ) modified, and True is returned. Otherwise s1 is unchanged and False is returned. */ -static Bool maybe_merge_nsegments ( NSegment* s1, NSegment* s2 ) +static Bool maybe_merge_nsegments ( NSegment* s1, const NSegment* s2 ) { if (s1->kind != s2->kind) return False; @@ -1485,7 +1485,7 @@ void split_nsegments_lo_and_hi ( Addr sLo, Addr sHi, This deals with all the tricky cases of splitting up segments as needed. */ -static void add_segment ( NSegment* seg ) +static void add_segment ( const NSegment* seg ) { Int i, iLo, iHi, delta; Bool segment_is_sane; @@ -1755,8 +1755,8 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) /* Query aspacem to ask where a mapping should go. */ -Addr VG_(am_get_advisory) ( MapRequest* req, - Bool forClient, +Addr VG_(am_get_advisory) ( const MapRequest* req, + Bool forClient, /*OUT*/Bool* ok ) { /* This function implements allocation policy. diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h index 34605a02c6..99fd255f10 100644 --- a/coregrind/m_aspacemgr/priv_aspacemgr.h +++ b/coregrind/m_aspacemgr/priv_aspacemgr.h @@ -110,7 +110,7 @@ extern SysRes ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY)( extern SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode ); extern void ML_(am_close) ( Int fd ); extern Int ML_(am_read) ( Int fd, void* buf, Int count); -extern Int ML_(am_readlink) ( HChar* path, HChar* buf, UInt bufsiz ); +extern Int ML_(am_readlink) ( const HChar* path, HChar* buf, UInt bufsiz ); extern Int ML_(am_fcntl) ( Int fd, Int cmd, Addr arg ); /* Get the dev, inode and mode info for a file descriptor, if diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c index d3f6735ed1..2f7f802ecd 100644 --- a/coregrind/m_debuginfo/d3basics.c +++ b/coregrind/m_debuginfo/d3basics.c @@ -377,7 +377,7 @@ ULong read_leb128 ( const UChar* data, Int* length_return, Int sign ) * value is returned and the given pointer is * moved past end of leb128 data */ /* FIXME: duplicated in readdwarf.c */ -static ULong read_leb128U( UChar **data ) +static ULong read_leb128U( const UChar **data ) { Int len; ULong val = read_leb128( *data, &len, 0 ); @@ -387,7 +387,7 @@ static ULong read_leb128U( UChar **data ) /* Same for signed data */ /* FIXME: duplicated in readdwarf.c */ -static Long read_leb128S( UChar **data ) +static Long read_leb128S( const UChar **data ) { Int len; ULong val = read_leb128( *data, &len, 1 ); @@ -473,8 +473,8 @@ static Bool bias_address( Addr* a, const DebugInfo* di ) /* Evaluate a standard DWARF3 expression. See detailed description in priv_d3basics.h. Doesn't handle DW_OP_piece/DW_OP_bit_piece yet. */ -GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, - GExpr* fbGX, const RegSummary* regs, +GXResult ML_(evaluate_Dwarf3_Expr) ( const UChar* expr, UWord exprszB, + const GExpr* fbGX, const RegSummary* regs, const DebugInfo* di, Bool push_initial_zero ) { @@ -506,7 +506,7 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, } while (0) UChar opcode; - UChar* limit; + const UChar* limit; Int sp; /* # of top element: valid is -1 .. N_EXPR_STACK-1 */ Addr stack[N_EXPR_STACK]; /* stack of addresses, as per D3 spec */ GXResult fbval, res; @@ -728,7 +728,7 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, PUSH(uw1); break; case DW_OP_const1s: - uw1 = *(Char *)expr; + uw1 = *(const Char *)expr; expr++; PUSH(uw1); break; @@ -942,7 +942,7 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, /* Evaluate a so-called Guarded (DWARF3) expression. See detailed description in priv_d3basics.h. */ -GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, +GXResult ML_(evaluate_GX)( const GExpr* gx, const GExpr* fbGX, const RegSummary* regs, const DebugInfo* di ) { GXResult res; @@ -950,7 +950,7 @@ GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, UChar uc; UShort nbytes; UWord nGuards = 0; - UChar* p = &gx->payload[0]; + const UChar* p = &gx->payload[0]; uc = *p++; /*biasMe*/ vg_assert(uc == 0 || uc == 1); /* in fact it's senseless to evaluate if the guards need biasing. @@ -1014,7 +1014,7 @@ GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, Really it ought to be pulled out and turned into a general constant- expression evaluator. */ -GXResult ML_(evaluate_trivial_GX)( GExpr* gx, const DebugInfo* di ) +GXResult ML_(evaluate_trivial_GX)( const GExpr* gx, const DebugInfo* di ) { GXResult res; Addr aMin, aMax; @@ -1024,7 +1024,7 @@ GXResult ML_(evaluate_trivial_GX)( GExpr* gx, const DebugInfo* di ) MaybeULong *mul, *mul2; const HChar* badness = NULL; - UChar* p = &gx->payload[0]; /* must remain unsigned */ + const UChar* p = &gx->payload[0]; /* must remain unsigned */ XArray* results = VG_(newXA)( ML_(dinfo_zalloc), "di.d3basics.etG.1", ML_(dinfo_free), sizeof(MaybeULong) ); diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 3d61d570a3..33bfe924e0 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1970,7 +1970,7 @@ Bool VG_(get_objname) ( Addr a, HChar* buf, Int nbuf ) { DebugInfo* di; const NSegment *seg; - HChar* filename; + const HChar* filename; vg_assert(nbuf > 0); /* Look in the debugInfo_list to find the name. In most cases we expect this to produce a result. */ @@ -2164,7 +2164,8 @@ static Int putStr ( Int n, Int n_buf, HChar* buf, const HChar* str ) /* Same as putStr, but escaping chars for XML output, and also not adding more than count chars to n_buf. */ -static Int putStrEsc ( Int n, Int n_buf, Int count, HChar* buf, HChar* str ) +static Int putStrEsc ( Int n, Int n_buf, Int count, HChar* buf, + const HChar* str ) { HChar alt[2]; vg_assert(n_buf > 0); @@ -2423,7 +2424,7 @@ HChar* VG_(describe_IP)(Addr eip, HChar* buf, Int n_buf, InlIPCursor *iipc) a CfiExpr into one convenient struct. */ typedef struct { - D3UnwindRegs* uregs; + const D3UnwindRegs* uregs; Addr min_accessible; Addr max_accessible; } @@ -2434,12 +2435,12 @@ typedef caller must set it to True before calling. */ __attribute__((noinline)) static -UWord evalCfiExpr ( XArray* exprs, Int ix, - CfiExprEvalContext* eec, Bool* ok ) +UWord evalCfiExpr ( const XArray* exprs, Int ix, + const CfiExprEvalContext* eec, Bool* ok ) { UWord w, wL, wR; Addr a; - CfiExpr* e; + const CfiExpr* e; vg_assert(sizeof(Addr) == sizeof(UWord)); e = VG_(indexXA)( exprs, ix ); switch (e->tag) { @@ -2688,9 +2689,9 @@ static inline CFSI_m_CacheEnt* cfsi_m_cache__find ( Addr ip ) inline -static Addr compute_cfa ( D3UnwindRegs* uregs, +static Addr compute_cfa ( const D3UnwindRegs* uregs, Addr min_accessible, Addr max_accessible, - DebugInfo* di, DiCfSI_m* cfsi_m ) + const DebugInfo* di, const DiCfSI_m* cfsi_m ) { CfiExprEvalContext eec; Addr cfa; @@ -2968,7 +2969,7 @@ Bool VG_(use_FPO_info) ( /*MOD*/Addr* ipP, Addr max_accessible ) { Word i; - DebugInfo* di; + const DebugInfo* di; FPO_DATA* fpo = NULL; Addr spHere; @@ -3108,10 +3109,10 @@ static void zterm_XA ( XArray* dst ) regs, which supplies ip,sp,fp values, will be NULL for global variables, and non-NULL for local variables. */ static Bool data_address_is_in_var ( /*OUT*/PtrdiffT* offset, - XArray* /* TyEnt */ tyents, - DiVariable* var, - RegSummary* regs, - Addr data_addr, + const XArray* /* TyEnt */ tyents, + const DiVariable* var, + const RegSummary* regs, + Addr data_addr, const DebugInfo* di ) { MaybeULong mul; @@ -3790,8 +3791,8 @@ Bool VG_(get_data_description)( static void analyse_deps ( /*MOD*/XArray* /* of FrameBlock */ blocks, - XArray* /* TyEnt */ tyents, - Addr ip, const DebugInfo* di, DiVariable* var, + const XArray* /* TyEnt */ tyents, + Addr ip, const DebugInfo* di, const DiVariable* var, Bool arrays_only ) { GXResult res_sp_6k, res_sp_7k, res_fp_6k, res_fp_7k; diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c index 21ebe3005c..e959a0f8f4 100644 --- a/coregrind/m_debuginfo/image.c +++ b/coregrind/m_debuginfo/image.c @@ -311,7 +311,8 @@ static Frame* mk_Frame_asciiz ( const HChar* tag, const HChar* str ) return f; } -static Bool parse_Frame_le64 ( Frame* fr, const HChar* tag, /*OUT*/ULong* n1 ) +static Bool parse_Frame_le64 ( const Frame* fr, const HChar* tag, + /*OUT*/ULong* n1 ) { vg_assert(VG_(strlen)(tag) == 4); if (!fr || !fr->data) return False; @@ -322,7 +323,7 @@ static Bool parse_Frame_le64 ( Frame* fr, const HChar* tag, /*OUT*/ULong* n1 ) return True; } -static Bool parse_Frame_le64_le64 ( Frame* fr, const HChar* tag, +static Bool parse_Frame_le64_le64 ( const Frame* fr, const HChar* tag, /*OUT*/ULong* n1, /*OUT*/ULong* n2 ) { vg_assert(VG_(strlen)(tag) == 4); @@ -335,7 +336,7 @@ static Bool parse_Frame_le64_le64 ( Frame* fr, const HChar* tag, return True; } -static Bool parse_Frame_asciiz ( Frame* fr, const HChar* tag, +static Bool parse_Frame_asciiz ( const Frame* fr, const HChar* tag, /*OUT*/UChar** str ) { vg_assert(VG_(strlen)(tag) == 4); @@ -362,7 +363,7 @@ static Bool parse_Frame_asciiz ( Frame* fr, const HChar* tag, } static Bool parse_Frame_le64_le64_le64_bytes ( - Frame* fr, const HChar* tag, + const Frame* fr, const HChar* tag, /*OUT*/ULong* n1, /*OUT*/ULong* n2, /*OUT*/ULong* n3, /*OUT*/UChar** data, /*OUT*/ULong* n_data ) @@ -426,7 +427,7 @@ static void move_CEnt_to_top ( DiImage* img, UInt entNo ) the given offset. It is this function that brings data into the cache, either by reading the local file or pulling it from the remote server. */ -static void set_CEnt ( DiImage* img, UInt entNo, DiOffT off ) +static void set_CEnt ( const DiImage* img, UInt entNo, DiOffT off ) { SizeT len; DiOffT off_orig = off; @@ -825,7 +826,7 @@ SizeT ML_(img_get_some)(/*OUT*/void* dst, dstU[0] = get(img, offset); /* Now just read as many bytes as we can (or need) directly out of entry zero, without bothering to call |get| each time. */ - CEnt* ce = img->ces[0]; + const CEnt* ce = img->ces[0]; vg_assert(ce && ce->used >= 1); vg_assert(is_in_CEnt(ce, offset)); SizeT nToCopy = size - 1; diff --git a/coregrind/m_debuginfo/priv_d3basics.h b/coregrind/m_debuginfo/priv_d3basics.h index 1366b117f5..ff93ad4588 100644 --- a/coregrind/m_debuginfo/priv_d3basics.h +++ b/coregrind/m_debuginfo/priv_d3basics.h @@ -652,7 +652,7 @@ void ML_(pp_GXResult) ( GXResult res ); computed, then fbGX can provide an expression for it. If fbGX is NULL but the frame base is still needed, then evaluation of gx as a whole will fail. */ -GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, +GXResult ML_(evaluate_GX)( const GExpr* gx, const GExpr* fbGX, const RegSummary* regs, const DebugInfo* di ); /* This is a subsidiary of ML_(evaluate_GX), which just evaluates a @@ -662,8 +662,8 @@ GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, This is needed for computing structure field offsets. Note that ML_(evaluate_GX) and ML_(evaluate_Dwarf3_Expr) are mutually recursive. */ -GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, - GExpr* fbGX, const RegSummary* regs, +GXResult ML_(evaluate_Dwarf3_Expr) ( const UChar* expr, UWord exprszB, + const GExpr* fbGX, const RegSummary* regs, const DebugInfo* di, Bool push_initial_zero ); @@ -674,7 +674,7 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, location is denoted, a frame base expression is required, or the expression is not manifestly a constant. The range of addresses covered by the guard is also ignored. */ -GXResult ML_(evaluate_trivial_GX)( GExpr* gx, const DebugInfo* di ); +GXResult ML_(evaluate_trivial_GX)( const GExpr* gx, const DebugInfo* di ); /* Compute call frame address (CFA) for IP/SP/FP. */ Addr ML_(get_CFA) ( Addr ip, Addr sp, Addr fp, diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h index 1f02503f26..3afa502bb0 100644 --- a/coregrind/m_debuginfo/priv_storage.h +++ b/coregrind/m_debuginfo/priv_storage.h @@ -478,8 +478,8 @@ typedef struct { const HChar* name; /* in DebugInfo.strpool */ UWord typeR; /* a cuOff */ - GExpr* gexpr; /* on DebugInfo.gexprs list */ - GExpr* fbGX; /* SHARED. */ + const GExpr* gexpr; /* on DebugInfo.gexprs list */ + const GExpr* fbGX; /* SHARED. */ UInt fndn_ix; /* where declared; may be zero. index in DebugInfo.fndnpool */ Int lineNo; /* where declared; may be zero. */ @@ -1058,8 +1058,8 @@ extern void ML_(addVar)( struct _DebugInfo* di, Addr aMax, const HChar* name, UWord typeR, /* a cuOff */ - GExpr* gexpr, - GExpr* fbGX, /* SHARED. */ + const GExpr* gexpr, + const GExpr* fbGX, /* SHARED. */ UInt fndn_ix, /* where decl'd - may be zero */ Int lineNo, /* where decl'd - may be zero */ Bool show ); diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index af6ba2b2b5..14096d4f67 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -1898,7 +1898,7 @@ typedef } RegRule; -static void ppRegRule ( XArray* exprs, const RegRule* rrule ) +static void ppRegRule ( const XArray* exprs, const RegRule* rrule ) { vg_assert(exprs); switch (rrule->tag) { diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c index 154049911a..cea8aed649 100644 --- a/coregrind/m_debuginfo/readdwarf3.c +++ b/coregrind/m_debuginfo/readdwarf3.c @@ -232,7 +232,7 @@ static /*signed*/Long get_remaining_length_Cursor ( const Cursor* c ) { // return &c->region_start_img[ c->region_next ]; //} -static DiCursor get_DiCursor_from_Cursor ( Cursor* c ) { +static DiCursor get_DiCursor_from_Cursor ( const Cursor* c ) { return mk_DiCursor(c->sli.img, c->sli_next); } @@ -774,7 +774,8 @@ typedef /* Generate an arbitrary structural total ordering on XArray* of AddrRange. */ -static Word cmp__XArrays_of_AddrRange ( XArray* rngs1, XArray* rngs2 ) +static Word cmp__XArrays_of_AddrRange ( const XArray* rngs1, + const XArray* rngs2 ) { Word n1, n2, i; vg_assert(rngs1 && rngs2); @@ -2907,7 +2908,8 @@ static Bool typestack_is_empty ( const D3TypeParser* parser ) static void typestack_push ( const CUConst* cc, D3TypeParser* parser, Bool td3, - TyEnt* parentE, Int level ) { + TyEnt* parentE, Int level ) +{ if (0) TRACE_D3("BBBBAAAA typestack_push[newsp=%d]: %d %05lx\n", parser->sp+1, level, parentE->cuOff); @@ -3780,7 +3782,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents, /*------------------------------------------------------------*/ static UWord chase_cuOff ( Bool* changed, - XArray* /* of TyEnt */ ents, + const XArray* /* of TyEnt */ ents, TyEntIndexCache* ents_cache, UWord cuOff ) { @@ -3806,7 +3808,7 @@ static UWord chase_cuOff ( Bool* changed, static void chase_cuOffs_in_XArray ( Bool* changed, - XArray* /* of TyEnt */ ents, + const XArray* /* of TyEnt */ ents, TyEntIndexCache* ents_cache, /*MOD*/XArray* /* of UWord */ cuOffs ) { @@ -3822,7 +3824,7 @@ void chase_cuOffs_in_XArray ( Bool* changed, *changed = b2; } -static Bool TyEnt__subst_R_fields ( XArray* /* of TyEnt */ ents, +static Bool TyEnt__subst_R_fields ( const XArray* /* of TyEnt */ ents, TyEntIndexCache* ents_cache, /*MOD*/TyEnt* te ) { diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index 21553e9e70..a6fd56a189 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -675,7 +675,7 @@ static Bool check_uuid_matches ( DiSlice sli, UChar* uuid ) /* Heuristic kludge: return True if this looks like an installed standard library; hence we shouldn't consider automagically running dsymutil on it. */ -static Bool is_systemish_library_name ( HChar* name ) +static Bool is_systemish_library_name ( const HChar* name ) { vg_assert(name); if (0 == VG_(strncasecmp)(name, "/usr/", 5) diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c index 1cccd31c96..ec48ca7ae9 100644 --- a/coregrind/m_debuginfo/storage.c +++ b/coregrind/m_debuginfo/storage.c @@ -920,7 +920,7 @@ void ML_(ppCfiExpr)( const XArray* src, Int ix ) { /* VG_(indexXA) checks for invalid src/ix values, so we can use it indiscriminately. */ - CfiExpr* e = (CfiExpr*) VG_(indexXA)( src, ix ); + const CfiExpr* e = VG_(indexXA)( src, ix ); switch (e->tag) { case Cex_Undef: VG_(printf)("Undef"); @@ -1144,8 +1144,8 @@ void ML_(addVar)( struct _DebugInfo* di, Addr aMax, const HChar* name, /* in di's .strpool */ UWord typeR, /* a cuOff */ - GExpr* gexpr, - GExpr* fbGX, + const GExpr* gexpr, + const GExpr* fbGX, UInt fndn_ix, /* where decl'd - may be zero. index in in di's .fndnpool */ Int lineNo, /* where decl'd - may be zero */ diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c index 6cb9096c10..a2abf71974 100644 --- a/coregrind/m_debuginfo/tytypes.c +++ b/coregrind/m_debuginfo/tytypes.c @@ -204,7 +204,7 @@ void ML_(pp_TyEnts)( const XArray* tyents, const HChar* who ) VG_(printf)("------ %s ------\n", who); n = VG_(sizeXA)( tyents ); for (i = 0; i < n; i++) { - TyEnt* tyent = (TyEnt*)VG_(indexXA)( tyents, i ); + const TyEnt* tyent = VG_(indexXA)( tyents, i ); VG_(printf)(" [%5ld] ", i); ML_(pp_TyEnt)( tyent ); VG_(printf)("\n"); diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c index b84f84ca68..a380f05f68 100644 --- a/coregrind/m_libcsignal.c +++ b/coregrind/m_libcsignal.c @@ -133,7 +133,7 @@ Int VG_(sigismember) ( const vki_sigset_t* set, Int signum ) } /* Add all signals in src to dst. */ -void VG_(sigaddset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) +void VG_(sigaddset_from_set)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); @@ -142,7 +142,7 @@ void VG_(sigaddset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) } /* Remove all signals in src from dst. */ -void VG_(sigdelset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) +void VG_(sigdelset_from_set)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); @@ -151,7 +151,7 @@ void VG_(sigdelset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) } /* dst = dst `intersect` src. */ -void VG_(sigintersectset)( vki_sigset_t* dst, vki_sigset_t* src ) +void VG_(sigintersectset)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); @@ -160,7 +160,7 @@ void VG_(sigintersectset)( vki_sigset_t* dst, vki_sigset_t* src ) } /* dst = ~src */ -void VG_(sigcomplementset)( vki_sigset_t* dst, vki_sigset_t* src ) +void VG_(sigcomplementset)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); @@ -280,7 +280,7 @@ Int VG_(sigaction) ( Int signum, /* See explanation in pub_core_libcsignal.h. */ void -VG_(convert_sigaction_fromK_to_toK)( vki_sigaction_fromK_t* fromK, +VG_(convert_sigaction_fromK_to_toK)( const vki_sigaction_fromK_t* fromK, /*OUT*/vki_sigaction_toK_t* toK ) { # if defined(VGO_linux) diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index 890ac3a03f..0e4e269919 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -149,7 +149,7 @@ typedef set to False, it means aspacem has vetoed the mapping, and so the caller should not proceed with it. */ extern Addr VG_(am_get_advisory) - ( MapRequest* req, Bool forClient, /*OUT*/Bool* ok ); + ( const MapRequest* req, Bool forClient, /*OUT*/Bool* ok ); /* Convenience wrapper for VG_(am_get_advisory) for client floating or fixed requests. If start is zero, a floating request is issued; if @@ -365,7 +365,8 @@ extern VgStack* VG_(am_alloc_VgStack)( /*OUT*/Addr* initial_sp ); /* Figure out how many bytes of the stack's active area have not been used. Used for estimating if we are close to overflowing it. If the free area is larger than 'limit', just return 'limit'. */ -extern SizeT VG_(am_get_VgStack_unused_szB)( VgStack* stack, SizeT limit ); +extern SizeT VG_(am_get_VgStack_unused_szB)( const VgStack* stack, + SizeT limit ); // DDD: this is ugly #if defined(VGO_darwin) diff --git a/coregrind/pub_core_libcsignal.h b/coregrind/pub_core_libcsignal.h index 8e94902f1b..46fa22ca64 100644 --- a/coregrind/pub_core_libcsignal.h +++ b/coregrind/pub_core_libcsignal.h @@ -55,10 +55,10 @@ extern Int VG_(sigaddset) ( vki_sigset_t* set, Int signum ); extern Int VG_(sigdelset) ( vki_sigset_t* set, Int signum ); extern Int VG_(sigismember) ( const vki_sigset_t* set, Int signum ); -extern void VG_(sigaddset_from_set) ( vki_sigset_t* dst, vki_sigset_t* src ); -extern void VG_(sigdelset_from_set) ( vki_sigset_t* dst, vki_sigset_t* src ); -extern void VG_(sigintersectset) ( vki_sigset_t* dst, vki_sigset_t* src ); -extern void VG_(sigcomplementset) ( vki_sigset_t* dst, vki_sigset_t* src ); +extern void VG_(sigaddset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src ); +extern void VG_(sigdelset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src ); +extern void VG_(sigintersectset) ( vki_sigset_t* dst, const vki_sigset_t* src ); +extern void VG_(sigcomplementset) ( vki_sigset_t* dst, const vki_sigset_t* src ); /* --- Mess with the kernel's sig state --- */ /* VG_(sigprocmask) is in pub_tool_libcsignal.h. */ @@ -72,7 +72,7 @@ extern Int VG_(sigaction) ( Int signum, vki_sigaction_{toK,fromK}_t are identical, so this is a no-op (structure copy), but on Darwin it's not a no-op. */ extern void VG_(convert_sigaction_fromK_to_toK)( - vki_sigaction_fromK_t*, /*OUT*/vki_sigaction_toK_t*); + const vki_sigaction_fromK_t*, /*OUT*/vki_sigaction_toK_t*); extern Int VG_(kill) ( Int pid, Int signo );