Skip to content

Commit

Permalink
Lint: more constant expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
krader1961 committed Sep 12, 2018
1 parent e554582 commit 64c5e03
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/lint
Expand Up @@ -212,6 +212,7 @@ then
fi

oclint -p "${PWD}" -enable-clang-static-analyzer ${enable_global_analysis} \
-extra-arg="-D_OCLINT_" \
-extra-arg="-isystem" -extra-arg="${system_hdrs}" "${c_files[@]}" 2>&1 |
sed -e 's,^\.\./,,'
fi
1 change: 1 addition & 0 deletions config_ast.h.in
Expand Up @@ -45,6 +45,7 @@
#mesondefine _ast_sizeof_pointer
#mesondefine _ast_sizeof_size_t
#mesondefine _ast_sizeof_int32_t
#mesondefine _ast_sizeof_wchar_t
#mesondefine _cmd_newgrp
#mesondefine _cmd_nfsd
#mesondefine _cmd_tput
Expand Down
1 change: 1 addition & 0 deletions meson.build
Expand Up @@ -230,6 +230,7 @@ feature_data.set('_ast_sizeof_long', long_size)
feature_data.set('_ast_sizeof_size_t', size_t_size)
feature_data.set('_ast_sizeof_off_t', off_t_size)
feature_data.set('_ast_sizeof_pointer', ptr_size)
feature_data.set('_ast_sizeof_wchar_t', wchar_t_size)
feature_data.set('_ptr_bits', ptr_size * 8)

subdir('features')
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/edit.h
Expand Up @@ -33,7 +33,7 @@
#define LOOKAHEAD 80

typedef wchar_t genchar;
#define CHARSIZE (sizeof(wchar_t) <= 2 ? 3 : sizeof(wchar_t))
#define CHARSIZE _ast_sizeof_wchar_t

#define TABSIZE 8
#define PRSIZE 256
Expand Down
15 changes: 15 additions & 0 deletions src/lib/libast/include/ast.h
Expand Up @@ -313,4 +313,19 @@ extern unsigned long plugin_version(void);
#define CC_sub 0032 // SUB character
#define CC_vt 0013 // VT character

// If running under the oclint tool try to suppress some platform specific warnings.
// For example, on macOS many commonly used functions are defined in terms of macros
// that contain expressions which always evalute true or false.
#if _OCLINT_

#undef strcat
#undef strcpy
#undef strncpy
#undef strlcat
#undef strlcpy
#undef memcpy
#undef memmove

#endif

#endif // _AST_H

0 comments on commit 64c5e03

Please sign in to comment.